Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: chrome/browser/privacy_blacklist/blacklist_manager_browsertest.cc

Issue 361003: Fix BlacklistManagerBrowserTest.Basic to be more solid. (Closed)
Patch Set: Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
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 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/privacy_blacklist/blacklist_manager.h" 5 #include "chrome/browser/privacy_blacklist/blacklist_manager.h"
6 6
7 #include "chrome/browser/browser.h" 7 #include "chrome/browser/browser.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/extensions/extension_browsertest.h" 9 #include "chrome/browser/extensions/extension_browsertest.h"
10 #include "chrome/browser/profile.h" 10 #include "chrome/browser/profile.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 registrar.Add(this, 62 registrar.Add(this,
63 NotificationType::BLACKLIST_MANAGER_BLACKLIST_READ_FINISHED, 63 NotificationType::BLACKLIST_MANAGER_BLACKLIST_READ_FINISHED,
64 Source<Profile>(browser()->profile())); 64 Source<Profile>(browser()->profile()));
65 ui_test_utils::RunMessageLoop(); 65 ui_test_utils::RunMessageLoop();
66 } 66 }
67 67
68 scoped_refptr<BlacklistManager> blacklist_manager_; 68 scoped_refptr<BlacklistManager> blacklist_manager_;
69 }; 69 };
70 70
71 IN_PROC_BROWSER_TEST_F(BlacklistManagerBrowserTest, Basic) { 71 IN_PROC_BROWSER_TEST_F(BlacklistManagerBrowserTest, Basic) {
72 static const char kTestUrl[] = "http://host/annoying_ads/ad.jpg";
73
72 InitializeBlacklistManager(); 74 InitializeBlacklistManager();
73 ASSERT_TRUE(blacklist_manager_->GetCompiledBlacklist()); 75 ASSERT_TRUE(blacklist_manager_->GetCompiledBlacklist());
74 EXPECT_FALSE(BlacklistHasMatch(blacklist_manager_->GetCompiledBlacklist(), 76 EXPECT_FALSE(BlacklistHasMatch(blacklist_manager_->GetCompiledBlacklist(),
75 "http://host/annoying_ads/ad.jpg")); 77 kTestUrl));
76 78
77 // Test loading an extension with blacklist. 79 // Test loading an extension with blacklist.
78 ASSERT_TRUE(LoadExtension( 80 ASSERT_TRUE(LoadExtension(
79 test_data_dir_.AppendASCII("common").AppendASCII("privacy_blacklist"))); 81 test_data_dir_.AppendASCII("common").AppendASCII("privacy_blacklist")));
80 WaitForBlacklistUpdate(); 82 if (!BlacklistHasMatch(blacklist_manager_->GetCompiledBlacklist(),
83 kTestUrl)) {
84 WaitForBlacklistUpdate();
85 }
81 EXPECT_TRUE(BlacklistHasMatch(blacklist_manager_->GetCompiledBlacklist(), 86 EXPECT_TRUE(BlacklistHasMatch(blacklist_manager_->GetCompiledBlacklist(),
82 "http://host/annoying_ads/ad.jpg")); 87 kTestUrl));
83 88
84 // Make sure that after unloading the extension we update the blacklist. 89 // Make sure that after unloading the extension we update the blacklist.
85 ExtensionsService* extensions_service = 90 ExtensionsService* extensions_service =
86 browser()->profile()->GetExtensionsService(); 91 browser()->profile()->GetExtensionsService();
87 ASSERT_EQ(1U, extensions_service->extensions()->size()); 92 ASSERT_EQ(1U, extensions_service->extensions()->size());
88 UnloadExtension(extensions_service->extensions()->front()->id()); 93 UnloadExtension(extensions_service->extensions()->front()->id());
89 WaitForBlacklistUpdate(); 94 if (BlacklistHasMatch(blacklist_manager_->GetCompiledBlacklist(),
95 kTestUrl)) {
96 WaitForBlacklistUpdate();
97 }
90 EXPECT_FALSE(BlacklistHasMatch(blacklist_manager_->GetCompiledBlacklist(), 98 EXPECT_FALSE(BlacklistHasMatch(blacklist_manager_->GetCompiledBlacklist(),
91 "http://host/annoying_ads/ad.jpg")); 99 kTestUrl));
92 } 100 }
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 408576698