| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/policy/url_blacklist_manager.h" | 5 #include "chrome/browser/policy/url_blacklist_manager.h" |
| 6 | 6 |
| 7 #include <ostream> | 7 #include <ostream> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 class URLBlacklistManagerTest : public testing::Test { | 66 class URLBlacklistManagerTest : public testing::Test { |
| 67 protected: | 67 protected: |
| 68 URLBlacklistManagerTest() | 68 URLBlacklistManagerTest() |
| 69 : ui_thread_(BrowserThread::UI, &loop_), | 69 : ui_thread_(BrowserThread::UI, &loop_), |
| 70 file_thread_(BrowserThread::FILE, &loop_), | 70 file_thread_(BrowserThread::FILE, &loop_), |
| 71 io_thread_(BrowserThread::IO, &loop_) { | 71 io_thread_(BrowserThread::IO, &loop_) { |
| 72 } | 72 } |
| 73 | 73 |
| 74 virtual void SetUp() OVERRIDE { | 74 virtual void SetUp() OVERRIDE { |
| 75 pref_service_.RegisterListPref(prefs::kUrlBlacklist); | 75 pref_service_.registrar()->RegisterListPref(prefs::kUrlBlacklist); |
| 76 pref_service_.RegisterListPref(prefs::kUrlWhitelist); | 76 pref_service_.registrar()->RegisterListPref(prefs::kUrlWhitelist); |
| 77 blacklist_manager_.reset( | 77 blacklist_manager_.reset( |
| 78 new TestingURLBlacklistManager(&pref_service_)); | 78 new TestingURLBlacklistManager(&pref_service_)); |
| 79 loop_.RunUntilIdle(); | 79 loop_.RunUntilIdle(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 virtual void TearDown() OVERRIDE { | 82 virtual void TearDown() OVERRIDE { |
| 83 if (blacklist_manager_.get()) | 83 if (blacklist_manager_.get()) |
| 84 blacklist_manager_->ShutdownOnUIThread(); | 84 blacklist_manager_->ShutdownOnUIThread(); |
| 85 loop_.RunUntilIdle(); | 85 loop_.RunUntilIdle(); |
| 86 // Delete |blacklist_manager_| while |io_thread_| is mapping IO to | 86 // Delete |blacklist_manager_| while |io_thread_| is mapping IO to |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 EXPECT_FALSE(blacklist.IsURLBlocked(GURL("http://s.plus.google.com"))); | 434 EXPECT_FALSE(blacklist.IsURLBlocked(GURL("http://s.plus.google.com"))); |
| 435 EXPECT_TRUE(blacklist.IsURLBlocked(GURL("http://mail.google.com"))); | 435 EXPECT_TRUE(blacklist.IsURLBlocked(GURL("http://mail.google.com"))); |
| 436 EXPECT_FALSE(blacklist.IsURLBlocked(GURL("https://mail.google.com"))); | 436 EXPECT_FALSE(blacklist.IsURLBlocked(GURL("https://mail.google.com"))); |
| 437 EXPECT_FALSE(blacklist.IsURLBlocked(GURL("https://s.mail.google.com"))); | 437 EXPECT_FALSE(blacklist.IsURLBlocked(GURL("https://s.mail.google.com"))); |
| 438 EXPECT_TRUE(blacklist.IsURLBlocked(GURL("https://very.safe/"))); | 438 EXPECT_TRUE(blacklist.IsURLBlocked(GURL("https://very.safe/"))); |
| 439 EXPECT_TRUE(blacklist.IsURLBlocked(GURL("http://very.safe/path"))); | 439 EXPECT_TRUE(blacklist.IsURLBlocked(GURL("http://very.safe/path"))); |
| 440 EXPECT_FALSE(blacklist.IsURLBlocked(GURL("https://very.safe/path"))); | 440 EXPECT_FALSE(blacklist.IsURLBlocked(GURL("https://very.safe/path"))); |
| 441 } | 441 } |
| 442 | 442 |
| 443 } // namespace policy | 443 } // namespace policy |
| OLD | NEW |