Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: test/BaseJsTest.h

Issue 29372702: Issue #4826 - Use latch to replace thread-sleeping in tests
Patch Set: Created Jan. 19, 2017, 5:56 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
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-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 #ifndef MOCKS_H 18 #ifndef MOCKS_H
19 #define MOCKS_H 19 #define MOCKS_H
20 20
21 #include <condition_variable> 21 #include <condition_variable>
22 #include <mutex> 22 #include <mutex>
23 #include <thread> 23 #include <thread>
24 24
25 #include <AdblockPlus.h> 25 #include <AdblockPlus.h>
26 #include "../src/JsEngineInternal.h"
26 #include <gtest/gtest.h> 27 #include <gtest/gtest.h>
27 28
28 class ThrowingLogSystem : public AdblockPlus::LogSystem 29 class ThrowingLogSystem : public AdblockPlus::LogSystem
29 { 30 {
30 public: 31 public:
31 void operator()(LogLevel logLevel, const std::string& message, 32 void operator()(LogLevel logLevel, const std::string& message,
32 const std::string& source) 33 const std::string& source)
33 { 34 {
34 throw std::runtime_error("Unexpected error: " + message); 35 throw std::runtime_error("Unexpected error: " + message);
35 } 36 }
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 { 175 {
175 } 176 }
176 }; 177 };
177 178
178 AdblockPlus::JsEnginePtr CreateJsEngine(const AdblockPlus::AppInfo& appInfo = Ad blockPlus::AppInfo()); 179 AdblockPlus::JsEnginePtr CreateJsEngine(const AdblockPlus::AppInfo& appInfo = Ad blockPlus::AppInfo());
179 180
180 class BaseJsTest : public ::testing::Test 181 class BaseJsTest : public ::testing::Test
181 { 182 {
182 protected: 183 protected:
183 AdblockPlus::JsEnginePtr jsEngine; 184 AdblockPlus::JsEnginePtr jsEngine;
185 JsEngineInternal* engine;
184 virtual void SetUp(); 186 virtual void SetUp();
185 virtual void TearDown(); 187 virtual void TearDown();
186 }; 188 };
187 189
188 #endif 190 #endif
OLDNEW
« no previous file with comments | « src/Latch.cpp ('k') | test/BaseJsTest.cpp » ('j') | test/GlobalJsObject.cpp » ('J')

Powered by Google App Engine
This is Rietveld