| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/history/history_service_factory.h" | 10 #include "chrome/browser/history/history_service_factory.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 supervised_user_service_ = | 107 supervised_user_service_ = |
| 108 SupervisedUserServiceFactory::GetForProfile(profile); | 108 SupervisedUserServiceFactory::GetForProfile(profile); |
| 109 SupervisedUserSettingsService* supervised_user_settings_service = | 109 SupervisedUserSettingsService* supervised_user_settings_service = |
| 110 SupervisedUserSettingsServiceFactory::GetForProfile(profile); | 110 SupervisedUserSettingsServiceFactory::GetForProfile(profile); |
| 111 supervised_user_settings_service->SetLocalSetting( | 111 supervised_user_settings_service->SetLocalSetting( |
| 112 supervised_users::kContentPackDefaultFilteringBehavior, | 112 supervised_users::kContentPackDefaultFilteringBehavior, |
| 113 scoped_ptr<base::Value>( | 113 scoped_ptr<base::Value>( |
| 114 new base::FundamentalValue(SupervisedUserURLFilter::BLOCK))); | 114 new base::FundamentalValue(SupervisedUserURLFilter::BLOCK))); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void SetUpCommandLine(CommandLine* command_line) override { | 117 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 118 // Enable the test server and remap all URLs to it. | 118 // Enable the test server and remap all URLs to it. |
| 119 ASSERT_TRUE(test_server()->Start()); | 119 ASSERT_TRUE(test_server()->Start()); |
| 120 std::string host_port = test_server()->host_port_pair().ToString(); | 120 std::string host_port = test_server()->host_port_pair().ToString(); |
| 121 command_line->AppendSwitchASCII(switches::kHostResolverRules, | 121 command_line->AppendSwitchASCII(switches::kHostResolverRules, |
| 122 "MAP *.example.com " + host_port + "," + | 122 "MAP *.example.com " + host_port + "," + |
| 123 "MAP *.new-example.com " + host_port + "," + | 123 "MAP *.new-example.com " + host_port + "," + |
| 124 "MAP *.a.com " + host_port); | 124 "MAP *.a.com " + host_port); |
| 125 | 125 |
| 126 command_line->AppendSwitchASCII(switches::kSupervisedUserId, "asdf"); | 126 command_line->AppendSwitchASCII(switches::kSupervisedUserId, "asdf"); |
| 127 } | 127 } |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 scoped_refptr<SupervisedUserURLFilter> filter = | 306 scoped_refptr<SupervisedUserURLFilter> filter = |
| 307 supervised_user_service_->GetURLFilterForUIThread(); | 307 supervised_user_service_->GetURLFilterForUIThread(); |
| 308 EXPECT_EQ(SupervisedUserURLFilter::ALLOW, | 308 EXPECT_EQ(SupervisedUserURLFilter::ALLOW, |
| 309 filter->GetFilteringBehaviorForURL(test_url.GetWithEmptyPath())); | 309 filter->GetFilteringBehaviorForURL(test_url.GetWithEmptyPath())); |
| 310 | 310 |
| 311 observer.Wait(); | 311 observer.Wait(); |
| 312 EXPECT_EQ(test_url, web_contents->GetURL()); | 312 EXPECT_EQ(test_url, web_contents->GetURL()); |
| 313 } | 313 } |
| 314 | 314 |
| 315 } // namespace | 315 } // namespace |
| OLD | NEW |