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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/test/histogram_tester.h" | 10 #include "base/test/histogram_tester.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 GURL url(https_server_->GetURL("/content_setting_bubble/mixed_script.html")); | 96 GURL url(https_server_->GetURL("/content_setting_bubble/mixed_script.html")); |
97 | 97 |
98 // Rappor treats local hostnames a little bit special (e.g. records | 98 // Rappor treats local hostnames a little bit special (e.g. records |
99 // "127.0.0.1" as "localhost"), so use a non-local hostname for | 99 // "127.0.0.1" as "localhost"), so use a non-local hostname for |
100 // convenience. | 100 // convenience. |
101 host_resolver()->AddRule("*", "127.0.0.1"); | 101 host_resolver()->AddRule("*", "127.0.0.1"); |
102 GURL::Replacements replace_host; | 102 GURL::Replacements replace_host; |
103 replace_host.SetHostStr("example.test"); | 103 replace_host.SetHostStr("example.test"); |
104 url = url.ReplaceComponents(replace_host); | 104 url = url.ReplaceComponents(replace_host); |
105 | 105 |
106 rappor::TestRapporService rappor_service; | 106 rappor::TestRapporServiceImpl rappor_service; |
107 EXPECT_EQ(0, rappor_service.GetReportsCount()); | 107 EXPECT_EQ(0, rappor_service.GetReportsCount()); |
108 base::HistogramTester histograms; | 108 base::HistogramTester histograms; |
109 histograms.ExpectTotalCount("ContentSettings.MixedScript", 0); | 109 histograms.ExpectTotalCount("ContentSettings.MixedScript", 0); |
110 | 110 |
111 // Load a page with mixed content and do quick verification by looking at | 111 // Load a page with mixed content and do quick verification by looking at |
112 // the title string. | 112 // the title string. |
113 ui_test_utils::NavigateToURL(browser(), url); | 113 ui_test_utils::NavigateToURL(browser(), url); |
114 | 114 |
115 EXPECT_TRUE(GetActiveTabSpecificContentSettings()->IsContentBlocked( | 115 EXPECT_TRUE(GetActiveTabSpecificContentSettings()->IsContentBlocked( |
116 CONTENT_SETTINGS_TYPE_MIXEDSCRIPT)); | 116 CONTENT_SETTINGS_TYPE_MIXEDSCRIPT)); |
117 | 117 |
118 // Emulate link clicking on the mixed script bubble. | 118 // Emulate link clicking on the mixed script bubble. |
119 std::unique_ptr<ContentSettingBubbleModel> model( | 119 std::unique_ptr<ContentSettingBubbleModel> model( |
120 ContentSettingBubbleModel::CreateContentSettingBubbleModel( | 120 ContentSettingBubbleModel::CreateContentSettingBubbleModel( |
121 browser()->content_setting_bubble_model_delegate(), | 121 browser()->content_setting_bubble_model_delegate(), |
122 browser()->tab_strip_model()->GetActiveWebContents(), | 122 browser()->tab_strip_model()->GetActiveWebContents(), |
123 browser()->profile(), CONTENT_SETTINGS_TYPE_MIXEDSCRIPT)); | 123 browser()->profile(), CONTENT_SETTINGS_TYPE_MIXEDSCRIPT)); |
124 model->SetRapporServiceForTesting(&rappor_service); | 124 model->SetRapporServiceImplForTesting(&rappor_service); |
125 model->OnCustomLinkClicked(); | 125 model->OnCustomLinkClicked(); |
126 | 126 |
127 // Wait for reload | 127 // Wait for reload |
128 content::TestNavigationObserver observer( | 128 content::TestNavigationObserver observer( |
129 browser()->tab_strip_model()->GetActiveWebContents()); | 129 browser()->tab_strip_model()->GetActiveWebContents()); |
130 observer.Wait(); | 130 observer.Wait(); |
131 | 131 |
132 EXPECT_FALSE(GetActiveTabSpecificContentSettings()->IsContentBlocked( | 132 EXPECT_FALSE(GetActiveTabSpecificContentSettings()->IsContentBlocked( |
133 CONTENT_SETTINGS_TYPE_MIXEDSCRIPT)); | 133 CONTENT_SETTINGS_TYPE_MIXEDSCRIPT)); |
134 | 134 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 | 221 |
222 // In ChromeOS, we do not sanitize chrome://settings-frame to | 222 // In ChromeOS, we do not sanitize chrome://settings-frame to |
223 // chrome://settings for same-document navigations. See crbug.com/416157. For | 223 // chrome://settings for same-document navigations. See crbug.com/416157. For |
224 // this reason, order the tests so no same-document navigation occurs. | 224 // this reason, order the tests so no same-document navigation occurs. |
225 | 225 |
226 // The camera bubble links to camera exceptions. | 226 // The camera bubble links to camera exceptions. |
227 ManageMediaStreamSettings(TabSpecificContentSettings::CAMERA_ACCESSED); | 227 ManageMediaStreamSettings(TabSpecificContentSettings::CAMERA_ACCESSED); |
228 EXPECT_EQ(GURL("chrome://settings/contentExceptions#media-stream-camera"), | 228 EXPECT_EQ(GURL("chrome://settings/contentExceptions#media-stream-camera"), |
229 GetActiveTab()->GetLastCommittedURL()); | 229 GetActiveTab()->GetLastCommittedURL()); |
230 } | 230 } |
OLD | NEW |