| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 struct ThrowingPlatformCreationParameters: AdblockPlus::Platform::CreationParame
ters | 260 struct ThrowingPlatformCreationParameters: AdblockPlus::Platform::CreationParame
ters |
| 261 { | 261 { |
| 262 ThrowingPlatformCreationParameters(); | 262 ThrowingPlatformCreationParameters(); |
| 263 }; | 263 }; |
| 264 | 264 |
| 265 class BaseJsTest : public ::testing::Test | 265 class BaseJsTest : public ::testing::Test |
| 266 { | 266 { |
| 267 protected: | 267 protected: |
| 268 std::unique_ptr<AdblockPlus::Platform> platform; | 268 std::unique_ptr<AdblockPlus::Platform> platform; |
| 269 | 269 |
| 270 virtual void SetUp() | 270 void SetUp() override |
| 271 { | 271 { |
| 272 platform.reset(new AdblockPlus::Platform(ThrowingPlatformCreationParameters(
))); | 272 platform.reset(new AdblockPlus::Platform(ThrowingPlatformCreationParameters(
))); |
| 273 } | 273 } |
| 274 |
| 275 AdblockPlus::JsEngine& GetJsEngine() |
| 276 { |
| 277 if (!platform) |
| 278 throw std::runtime_error("Platform must be initialized"); |
| 279 return platform->GetJsEngine(); |
| 280 } |
| 281 |
| 282 void TearDown() override |
| 283 { |
| 284 if (platform) |
| 285 platform.reset(); |
| 286 } |
| 274 }; | 287 }; |
| 275 | 288 |
| 276 #endif | 289 #endif |
| OLD | NEW |