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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/prefs/pref_service.h" | 6 #include "base/prefs/pref_service.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/common/cancelable_request.h" | 10 #include "chrome/browser/common/cancelable_request.h" |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 QueryHistory(history_service, "", options, &results); | 231 QueryHistory(history_service, "", options, &results); |
232 | 232 |
233 // Check that the entries have the correct blocked_visit value. | 233 // Check that the entries have the correct blocked_visit value. |
234 EXPECT_EQ(2u, results.size()); | 234 EXPECT_EQ(2u, results.size()); |
235 EXPECT_EQ(blocked_url.spec(), results[0].url().spec()); | 235 EXPECT_EQ(blocked_url.spec(), results[0].url().spec()); |
236 EXPECT_TRUE(results[0].blocked_visit()); | 236 EXPECT_TRUE(results[0].blocked_visit()); |
237 EXPECT_EQ(allowed_url.spec(), results[1].url().spec()); | 237 EXPECT_EQ(allowed_url.spec(), results[1].url().spec()); |
238 EXPECT_FALSE(results[1].blocked_visit()); | 238 EXPECT_FALSE(results[1].blocked_visit()); |
239 } | 239 } |
240 | 240 |
| 241 IN_PROC_BROWSER_TEST_F(ManagedModeBlockModeTest, Unblock) { |
| 242 GURL test_url("http://www.example.com/files/simple.html"); |
| 243 ui_test_utils::NavigateToURL(browser(), test_url); |
| 244 |
| 245 WebContents* web_contents = |
| 246 browser()->tab_strip_model()->GetActiveWebContents(); |
| 247 |
| 248 CheckShownPageIsInterstitial(web_contents); |
| 249 |
| 250 content::WindowedNotificationObserver observer( |
| 251 content::NOTIFICATION_LOAD_STOP, |
| 252 content::NotificationService::AllSources()); |
| 253 |
| 254 // Set the host as allowed. |
| 255 scoped_ptr<DictionaryValue> dict(new DictionaryValue); |
| 256 dict->SetBooleanWithoutPathExpansion(test_url.host(), true); |
| 257 policy::ProfilePolicyConnector* connector = |
| 258 policy::ProfilePolicyConnectorFactory::GetForProfile( |
| 259 browser()->profile()); |
| 260 policy::ManagedModePolicyProvider* policy_provider = |
| 261 connector->managed_mode_policy_provider(); |
| 262 policy_provider->SetLocalPolicyForTesting( |
| 263 policy::key::kContentPackManualBehaviorHosts, dict.PassAs<Value>()); |
| 264 base::RunLoop().RunUntilIdle(); |
| 265 EXPECT_EQ( |
| 266 ManagedUserService::MANUAL_ALLOW, |
| 267 managed_user_service_->GetManualBehaviorForHost(test_url.host())); |
| 268 |
| 269 observer.Wait(); |
| 270 EXPECT_EQ(test_url, web_contents->GetURL()); |
| 271 } |
| 272 |
241 } // namespace | 273 } // namespace |
OLD | NEW |