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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 HistoryVisitRecorded) { | 228 HistoryVisitRecorded) { |
229 GURL allowed_url("http://www.example.com/files/simple.html"); | 229 GURL allowed_url("http://www.example.com/files/simple.html"); |
230 | 230 |
231 // Set the host as allowed. | 231 // Set the host as allowed. |
232 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue); | 232 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue); |
233 dict->SetBooleanWithoutPathExpansion(allowed_url.host(), true); | 233 dict->SetBooleanWithoutPathExpansion(allowed_url.host(), true); |
234 SupervisedUserSettingsService* supervised_user_settings_service = | 234 SupervisedUserSettingsService* supervised_user_settings_service = |
235 SupervisedUserSettingsServiceFactory::GetForProfile( | 235 SupervisedUserSettingsServiceFactory::GetForProfile( |
236 browser()->profile()); | 236 browser()->profile()); |
237 supervised_user_settings_service->SetLocalSettingForTesting( | 237 supervised_user_settings_service->SetLocalSettingForTesting( |
238 supervised_users::kContentPackManualBehaviorHosts, | 238 supervised_users::kContentPackManualBehaviorHosts, dict.Pass()); |
239 dict.PassAs<base::Value>()); | |
240 EXPECT_EQ( | 239 EXPECT_EQ( |
241 SupervisedUserService::MANUAL_ALLOW, | 240 SupervisedUserService::MANUAL_ALLOW, |
242 supervised_user_service_->GetManualBehaviorForHost(allowed_url.host())); | 241 supervised_user_service_->GetManualBehaviorForHost(allowed_url.host())); |
243 | 242 |
244 ui_test_utils::NavigateToURL(browser(), allowed_url); | 243 ui_test_utils::NavigateToURL(browser(), allowed_url); |
245 | 244 |
246 // Navigate to it and check that we don't get an interstitial. | 245 // Navigate to it and check that we don't get an interstitial. |
247 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 246 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
248 CheckShownPageIsNotInterstitial(tab); | 247 CheckShownPageIsNotInterstitial(tab); |
249 | 248 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 content::NOTIFICATION_LOAD_STOP, | 294 content::NOTIFICATION_LOAD_STOP, |
296 content::NotificationService::AllSources()); | 295 content::NotificationService::AllSources()); |
297 | 296 |
298 // Set the host as allowed. | 297 // Set the host as allowed. |
299 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue); | 298 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue); |
300 dict->SetBooleanWithoutPathExpansion(test_url.host(), true); | 299 dict->SetBooleanWithoutPathExpansion(test_url.host(), true); |
301 SupervisedUserSettingsService* supervised_user_settings_service = | 300 SupervisedUserSettingsService* supervised_user_settings_service = |
302 SupervisedUserSettingsServiceFactory::GetForProfile( | 301 SupervisedUserSettingsServiceFactory::GetForProfile( |
303 browser()->profile()); | 302 browser()->profile()); |
304 supervised_user_settings_service->SetLocalSettingForTesting( | 303 supervised_user_settings_service->SetLocalSettingForTesting( |
305 supervised_users::kContentPackManualBehaviorHosts, | 304 supervised_users::kContentPackManualBehaviorHosts, dict.Pass()); |
306 dict.PassAs<base::Value>()); | |
307 EXPECT_EQ( | 305 EXPECT_EQ( |
308 SupervisedUserService::MANUAL_ALLOW, | 306 SupervisedUserService::MANUAL_ALLOW, |
309 supervised_user_service_->GetManualBehaviorForHost(test_url.host())); | 307 supervised_user_service_->GetManualBehaviorForHost(test_url.host())); |
310 | 308 |
311 observer.Wait(); | 309 observer.Wait(); |
312 EXPECT_EQ(test_url, web_contents->GetURL()); | 310 EXPECT_EQ(test_url, web_contents->GetURL()); |
313 } | 311 } |
314 | 312 |
315 } // namespace | 313 } // namespace |
OLD | NEW |