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