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 "chrome/browser/supervised_user/supervised_user_resource_throttle.h" | 5 #include "chrome/browser/supervised_user/supervised_user_resource_throttle.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // Tests that showing the blocking interstitial for a WebContents without a | 77 // Tests that showing the blocking interstitial for a WebContents without a |
78 // SupervisedUserNavigationObserver doesn't crash. | 78 // SupervisedUserNavigationObserver doesn't crash. |
79 IN_PROC_BROWSER_TEST_F(SupervisedUserResourceThrottleTest, | 79 IN_PROC_BROWSER_TEST_F(SupervisedUserResourceThrottleTest, |
80 NoNavigationObserverBlock) { | 80 NoNavigationObserverBlock) { |
81 Profile* profile = browser()->profile(); | 81 Profile* profile = browser()->profile(); |
82 SupervisedUserSettingsService* supervised_user_settings_service = | 82 SupervisedUserSettingsService* supervised_user_settings_service = |
83 SupervisedUserSettingsServiceFactory::GetForProfile(profile); | 83 SupervisedUserSettingsServiceFactory::GetForProfile(profile); |
84 supervised_user_settings_service->SetLocalSetting( | 84 supervised_user_settings_service->SetLocalSetting( |
85 supervised_users::kContentPackDefaultFilteringBehavior, | 85 supervised_users::kContentPackDefaultFilteringBehavior, |
86 std::unique_ptr<base::Value>( | 86 std::unique_ptr<base::Value>( |
87 new base::FundamentalValue(SupervisedUserURLFilter::BLOCK))); | 87 new base::Value(SupervisedUserURLFilter::BLOCK))); |
88 | 88 |
89 std::unique_ptr<WebContents> web_contents( | 89 std::unique_ptr<WebContents> web_contents( |
90 WebContents::Create(WebContents::CreateParams(profile))); | 90 WebContents::Create(WebContents::CreateParams(profile))); |
91 NavigationController& controller = web_contents->GetController(); | 91 NavigationController& controller = web_contents->GetController(); |
92 content::TestNavigationObserver observer(web_contents.get()); | 92 content::TestNavigationObserver observer(web_contents.get()); |
93 controller.LoadURL(GURL("http://www.example.com"), content::Referrer(), | 93 controller.LoadURL(GURL("http://www.example.com"), content::Referrer(), |
94 ui::PAGE_TRANSITION_TYPED, std::string()); | 94 ui::PAGE_TRANSITION_TYPED, std::string()); |
95 observer.Wait(); | 95 observer.Wait(); |
96 content::NavigationEntry* entry = controller.GetActiveEntry(); | 96 content::NavigationEntry* entry = controller.GetActiveEntry(); |
97 ASSERT_TRUE(entry); | 97 ASSERT_TRUE(entry); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 // Both iframes (from allowed host iframe1.com as well as from blocked host | 129 // Both iframes (from allowed host iframe1.com as well as from blocked host |
130 // iframe2.com) should be loaded normally, since we don't filter iframes | 130 // iframe2.com) should be loaded normally, since we don't filter iframes |
131 // (yet) - see crbug.com/651115. | 131 // (yet) - see crbug.com/651115. |
132 bool loaded1 = false; | 132 bool loaded1 = false; |
133 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(tab, "loaded1()", &loaded1)); | 133 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(tab, "loaded1()", &loaded1)); |
134 EXPECT_TRUE(loaded1); | 134 EXPECT_TRUE(loaded1); |
135 bool loaded2 = false; | 135 bool loaded2 = false; |
136 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(tab, "loaded2()", &loaded2)); | 136 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(tab, "loaded2()", &loaded2)); |
137 EXPECT_TRUE(loaded2); | 137 EXPECT_TRUE(loaded2); |
138 } | 138 } |
OLD | NEW |