| 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 "components/policy/core/common/url_blacklist_manager.h" | 5 #include "components/policy/core/common/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/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 &scheme, &host, &match_subdomains, &port, | 176 &scheme, &host, &match_subdomains, &port, |
| 177 &path); | 177 &path); |
| 178 EXPECT_EQ(GetParam().scheme(), scheme); | 178 EXPECT_EQ(GetParam().scheme(), scheme); |
| 179 EXPECT_EQ(GetParam().host(), host); | 179 EXPECT_EQ(GetParam().host(), host); |
| 180 EXPECT_EQ(GetParam().match_subdomains(), match_subdomains); | 180 EXPECT_EQ(GetParam().match_subdomains(), match_subdomains); |
| 181 EXPECT_EQ(GetParam().port(), port); | 181 EXPECT_EQ(GetParam().port(), port); |
| 182 EXPECT_EQ(GetParam().path(), path); | 182 EXPECT_EQ(GetParam().path(), path); |
| 183 } | 183 } |
| 184 | 184 |
| 185 TEST_F(URLBlacklistManagerTest, SingleUpdateForTwoPrefChanges) { | 185 TEST_F(URLBlacklistManagerTest, SingleUpdateForTwoPrefChanges) { |
| 186 ListValue* blacklist = new ListValue; | 186 base::ListValue* blacklist = new base::ListValue; |
| 187 blacklist->Append(new StringValue("*.google.com")); | 187 blacklist->Append(new base::StringValue("*.google.com")); |
| 188 ListValue* whitelist = new ListValue; | 188 base::ListValue* whitelist = new base::ListValue; |
| 189 whitelist->Append(new StringValue("mail.google.com")); | 189 whitelist->Append(new base::StringValue("mail.google.com")); |
| 190 pref_service_.SetManagedPref(policy_prefs::kUrlBlacklist, blacklist); | 190 pref_service_.SetManagedPref(policy_prefs::kUrlBlacklist, blacklist); |
| 191 pref_service_.SetManagedPref(policy_prefs::kUrlBlacklist, whitelist); | 191 pref_service_.SetManagedPref(policy_prefs::kUrlBlacklist, whitelist); |
| 192 loop_.RunUntilIdle(); | 192 loop_.RunUntilIdle(); |
| 193 | 193 |
| 194 EXPECT_EQ(1, blacklist_manager_->update_called()); | 194 EXPECT_EQ(1, blacklist_manager_->update_called()); |
| 195 } | 195 } |
| 196 | 196 |
| 197 TEST_F(URLBlacklistManagerTest, ShutdownWithPendingTask0) { | 197 TEST_F(URLBlacklistManagerTest, ShutdownWithPendingTask0) { |
| 198 // Post an update task to the UI thread. | 198 // Post an update task to the UI thread. |
| 199 blacklist_manager_->ScheduleUpdate(); | 199 blacklist_manager_->ScheduleUpdate(); |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 | 519 |
| 520 GURL sync_url(GaiaUrls::GetInstance()->service_login_url().Resolve( | 520 GURL sync_url(GaiaUrls::GetInstance()->service_login_url().Resolve( |
| 521 "?service=chromiumsync")); | 521 "?service=chromiumsync")); |
| 522 net::URLRequest sync_request(sync_url, net::DEFAULT_PRIORITY, NULL, &context); | 522 net::URLRequest sync_request(sync_url, net::DEFAULT_PRIORITY, NULL, &context); |
| 523 sync_request.SetLoadFlags(net::LOAD_MAIN_FRAME); | 523 sync_request.SetLoadFlags(net::LOAD_MAIN_FRAME); |
| 524 EXPECT_EQ(block_signin_urls, | 524 EXPECT_EQ(block_signin_urls, |
| 525 blacklist_manager_->IsRequestBlocked(sync_request)); | 525 blacklist_manager_->IsRequestBlocked(sync_request)); |
| 526 } | 526 } |
| 527 | 527 |
| 528 } // namespace policy | 528 } // namespace policy |
| OLD | NEW |