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

Side by Side Diff: test/FilterEngine.cpp

Issue 29424663: Issue 5198 - workaround for race condition in tests (Closed) Base URL: https://github.com/adblockplus/libadblockplus.git
Patch Set: add comment Created April 28, 2017, 1:12 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 FilterEnginePtr filterEngine; 50 FilterEnginePtr filterEngine;
51 51
52 void SetUp() 52 void SetUp()
53 { 53 {
54 BaseJsTest::SetUp(); 54 BaseJsTest::SetUp();
55 jsEngine->SetFileSystem(AdblockPlus::FileSystemPtr(new FileSystem)); 55 jsEngine->SetFileSystem(AdblockPlus::FileSystemPtr(new FileSystem));
56 jsEngine->SetWebRequest(AdblockPlus::WebRequestPtr(new LazyWebRequest)); 56 jsEngine->SetWebRequest(AdblockPlus::WebRequestPtr(new LazyWebRequest));
57 jsEngine->SetLogSystem(AdblockPlus::LogSystemPtr(new LogSystem)); 57 jsEngine->SetLogSystem(AdblockPlus::LogSystemPtr(new LogSystem));
58 filterEngine = AdblockPlus::FilterEngine::Create(jsEngine); 58 filterEngine = AdblockPlus::FilterEngine::Create(jsEngine);
59 } 59 }
60 void TearDown() override
61 {
62 // Workaround for issue 5198
63 std::this_thread::sleep_for(std::chrono::milliseconds(100));
64 }
60 }; 65 };
61 66
62 typedef FilterEngineTestGeneric<LazyFileSystem, AdblockPlus::DefaultLogSystem> FilterEngineTest; 67 typedef FilterEngineTestGeneric<LazyFileSystem, AdblockPlus::DefaultLogSystem> FilterEngineTest;
63 typedef FilterEngineTestGeneric<VeryLazyFileSystem, LazyLogSystem> FilterEngin eTestNoData; 68 typedef FilterEngineTestGeneric<VeryLazyFileSystem, LazyLogSystem> FilterEngin eTestNoData;
64 69
65 class UpdaterTest : public ::testing::Test 70 class UpdaterTest : public ::testing::Test
66 { 71 {
67 protected: 72 protected:
68 class MockWebRequest : public AdblockPlus::WebRequest 73 class MockWebRequest : public AdblockPlus::WebRequest
69 { 74 {
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 filterEngine->SetAllowedConnectionType(&testConnection); 1082 filterEngine->SetAllowedConnectionType(&testConnection);
1078 auto subscription = EnsureExampleSubscriptionAndForceUpdate("subB"); 1083 auto subscription = EnsureExampleSubscriptionAndForceUpdate("subB");
1079 EXPECT_EQ("synchronize_ok", subscription.GetProperty("downloadStatus").AsStr ing()); 1084 EXPECT_EQ("synchronize_ok", subscription.GetProperty("downloadStatus").AsStr ing());
1080 EXPECT_EQ(1u, subscription.GetProperty("filters").AsList().size()); 1085 EXPECT_EQ(1u, subscription.GetProperty("filters").AsList().size());
1081 auto capturedConnectionTypes = this->capturedConnectionTypes.GetStrings(); 1086 auto capturedConnectionTypes = this->capturedConnectionTypes.GetStrings();
1082 ASSERT_EQ(1u, capturedConnectionTypes.size()); 1087 ASSERT_EQ(1u, capturedConnectionTypes.size());
1083 EXPECT_TRUE(capturedConnectionTypes[0].first); 1088 EXPECT_TRUE(capturedConnectionTypes[0].first);
1084 EXPECT_EQ(testConnection, capturedConnectionTypes[0].second); 1089 EXPECT_EQ(testConnection, capturedConnectionTypes[0].second);
1085 } 1090 }
1086 } 1091 }
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