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/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 9 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 // Wait for reload | 68 // Wait for reload |
69 content::TestNavigationObserver observer( | 69 content::TestNavigationObserver observer( |
70 browser()->tab_strip_model()->GetActiveWebContents()); | 70 browser()->tab_strip_model()->GetActiveWebContents()); |
71 observer.Wait(); | 71 observer.Wait(); |
72 | 72 |
73 EXPECT_FALSE(GetActiveTabSpecificContentSettings()->IsContentBlocked( | 73 EXPECT_FALSE(GetActiveTabSpecificContentSettings()->IsContentBlocked( |
74 CONTENT_SETTINGS_TYPE_MIXEDSCRIPT)); | 74 CONTENT_SETTINGS_TYPE_MIXEDSCRIPT)); |
75 } | 75 } |
76 | 76 |
77 // Tests that a MIXEDSCRIPT type ContentSettingBubbleModel works for an iframe. | 77 // Tests that a MIXEDSCRIPT type ContentSettingBubbleModel does not work |
| 78 // for an iframe (mixed script in iframes is never allowed and the mixed |
| 79 // content shield isn't shown for it). |
78 IN_PROC_BROWSER_TEST_F(ContentSettingBubbleModelMixedScriptTest, Iframe) { | 80 IN_PROC_BROWSER_TEST_F(ContentSettingBubbleModelMixedScriptTest, Iframe) { |
79 GURL url(https_server_->GetURL( | 81 GURL url(https_server_->GetURL( |
80 "files/content_setting_bubble/mixed_script_in_iframe.html")); | 82 "files/content_setting_bubble/mixed_script_in_iframe.html")); |
81 | 83 |
82 ui_test_utils::NavigateToURL(browser(), url); | 84 ui_test_utils::NavigateToURL(browser(), url); |
83 | 85 |
84 EXPECT_TRUE(GetActiveTabSpecificContentSettings()->IsContentBlocked( | 86 // Blink does not ask the browser to handle mixed content in the case |
85 CONTENT_SETTINGS_TYPE_MIXEDSCRIPT)); | 87 // of active subresources in an iframe, so the content type should not |
86 | 88 // be marked as blocked. |
87 scoped_ptr<ContentSettingBubbleModel> model( | |
88 ContentSettingBubbleModel::CreateContentSettingBubbleModel( | |
89 browser()->content_setting_bubble_model_delegate(), | |
90 browser()->tab_strip_model()->GetActiveWebContents(), | |
91 browser()->profile(), | |
92 CONTENT_SETTINGS_TYPE_MIXEDSCRIPT)); | |
93 model->OnCustomLinkClicked(); | |
94 | |
95 content::TestNavigationObserver observer( | |
96 browser()->tab_strip_model()->GetActiveWebContents()); | |
97 observer.Wait(); | |
98 | |
99 EXPECT_FALSE(GetActiveTabSpecificContentSettings()->IsContentBlocked( | 89 EXPECT_FALSE(GetActiveTabSpecificContentSettings()->IsContentBlocked( |
100 CONTENT_SETTINGS_TYPE_MIXEDSCRIPT)); | 90 CONTENT_SETTINGS_TYPE_MIXEDSCRIPT)); |
101 } | 91 } |
102 | 92 |
103 class ContentSettingBubbleModelMediaStreamTest : public InProcessBrowserTest { | 93 class ContentSettingBubbleModelMediaStreamTest : public InProcessBrowserTest { |
104 public: | 94 public: |
105 void ManageMediaStreamSettings( | 95 void ManageMediaStreamSettings( |
106 TabSpecificContentSettings::MicrophoneCameraState state) { | 96 TabSpecificContentSettings::MicrophoneCameraState state) { |
107 // Open a tab for which we will invoke the media bubble. | 97 // Open a tab for which we will invoke the media bubble. |
108 GURL url(ui_test_utils::GetTestUrl( | 98 GURL url(ui_test_utils::GetTestUrl( |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 EXPECT_EQ(GURL("chrome://settings/contentExceptions#media-stream-camera"), | 146 EXPECT_EQ(GURL("chrome://settings/contentExceptions#media-stream-camera"), |
157 GetActiveTab()->GetLastCommittedURL()); | 147 GetActiveTab()->GetLastCommittedURL()); |
158 | 148 |
159 // The bubble for both media devices links to the the first section of the | 149 // The bubble for both media devices links to the the first section of the |
160 // default media content settings, which is the microphone section. | 150 // default media content settings, which is the microphone section. |
161 ManageMediaStreamSettings(TabSpecificContentSettings::MICROPHONE_ACCESSED | | 151 ManageMediaStreamSettings(TabSpecificContentSettings::MICROPHONE_ACCESSED | |
162 TabSpecificContentSettings::CAMERA_ACCESSED); | 152 TabSpecificContentSettings::CAMERA_ACCESSED); |
163 EXPECT_EQ(GURL("chrome://settings/content#media-stream-mic"), | 153 EXPECT_EQ(GURL("chrome://settings/content#media-stream-mic"), |
164 GetActiveTab()->GetLastCommittedURL()); | 154 GetActiveTab()->GetLastCommittedURL()); |
165 } | 155 } |
OLD | NEW |