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

Side by Side Diff: test/BaseJsTest.h

Issue 29496589: Noissue - workaround to reduce the probability of the race condition in tests (Closed) Base URL: https://github.com/adblockplus/libadblockplus.git
Patch Set: Created July 24, 2017, 1:02 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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-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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 public: 167 public:
168 void GET(const std::string& url, const AdblockPlus::HeaderList& requestHeaders , const GetCallback&) override 168 void GET(const std::string& url, const AdblockPlus::HeaderList& requestHeaders , const GetCallback&) override
169 { 169 {
170 throw std::runtime_error("Unexpected GET: " + url); 170 throw std::runtime_error("Unexpected GET: " + url);
171 } 171 }
172 }; 172 };
173 173
174 class LazyFileSystem : public AdblockPlus::IFileSystem, public AdblockPlus::File System 174 class LazyFileSystem : public AdblockPlus::IFileSystem, public AdblockPlus::File System
175 { 175 {
176 public: 176 public:
177 ~LazyFileSystem() {
178 std::this_thread::sleep_for(std::chrono::milliseconds(200));
179 }
177 IOBuffer Read(const std::string& path) const 180 IOBuffer Read(const std::string& path) const
178 { 181 {
179 std::string dummyData(""); 182 std::string dummyData("");
180 if (path == "patterns.ini") 183 if (path == "patterns.ini")
181 dummyData = "# Adblock Plus preferences\n[Subscription]\nurl=~fl~"; 184 dummyData = "# Adblock Plus preferences\n[Subscription]\nurl=~fl~";
182 else if (path == "prefs.json") 185 else if (path == "prefs.json")
183 dummyData = "{}"; 186 dummyData = "{}";
184 return IOBuffer(dummyData.cbegin(), dummyData.cend()); 187 return IOBuffer(dummyData.cbegin(), dummyData.cend());
185 } 188 }
186 189
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 protected: 314 protected:
312 AdblockPlus::JsEnginePtr jsEngine; 315 AdblockPlus::JsEnginePtr jsEngine;
313 316
314 virtual void SetUp() 317 virtual void SetUp()
315 { 318 {
316 jsEngine = CreateJsEngine(); 319 jsEngine = CreateJsEngine();
317 } 320 }
318 }; 321 };
319 322
320 #endif 323 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld