OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/test/ppapi/ppapi_test.h" | 5 #include "chrome/test/ppapi/ppapi_test.h" |
6 | 6 |
7 #include "base/test/test_timeouts.h" | 7 #include "base/test/test_timeouts.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "chrome/browser/content_settings/host_content_settings_map.h" | 9 #include "chrome/browser/content_settings/host_content_settings_map.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 // | 133 // |
134 // Interface tests. | 134 // Interface tests. |
135 // | 135 // |
136 | 136 |
137 TEST_PPAPI_IN_PROCESS(Broker) | 137 TEST_PPAPI_IN_PROCESS(Broker) |
138 // Flaky, http://crbug.com/111355 | 138 // Flaky, http://crbug.com/111355 |
139 TEST_PPAPI_OUT_OF_PROCESS(DISABLED_Broker) | 139 TEST_PPAPI_OUT_OF_PROCESS(DISABLED_Broker) |
140 | 140 |
141 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Accept) { | 141 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Accept) { |
142 // Accepting the infobar should grant permission to access the PPAPI broker. | 142 // Accepting the infobar should grant permission to access the PPAPI broker. |
143 InfoBarObserver observer; | 143 InfoBarObserver observer(this); |
144 observer.ExpectInfoBarAndAccept(true); | 144 observer.ExpectInfoBarAndAccept(true); |
145 | 145 |
146 // PPB_Broker_Trusted::IsAllowed should return false before the infobar is | 146 // PPB_Broker_Trusted::IsAllowed should return false before the infobar is |
147 // popped and true after the infobar is popped. | 147 // popped and true after the infobar is popped. |
148 RunTest("Broker_IsAllowedPermissionDenied"); | 148 RunTest("Broker_IsAllowedPermissionDenied"); |
149 RunTest("Broker_ConnectPermissionGranted"); | 149 RunTest("Broker_ConnectPermissionGranted"); |
150 RunTest("Broker_IsAllowedPermissionGranted"); | 150 RunTest("Broker_IsAllowedPermissionGranted"); |
151 | 151 |
152 // It should also set a content settings exception for the site. | 152 // It should also set a content settings exception for the site. |
153 GURL url = GetTestFileUrl("Broker_ConnectPermissionGranted"); | 153 GURL url = GetTestFileUrl("Broker_ConnectPermissionGranted"); |
154 HostContentSettingsMap* content_settings = | 154 HostContentSettingsMap* content_settings = |
155 browser()->profile()->GetHostContentSettingsMap(); | 155 browser()->profile()->GetHostContentSettingsMap(); |
156 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 156 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
157 content_settings->GetContentSetting( | 157 content_settings->GetContentSetting( |
158 url, url, CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string())); | 158 url, url, CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string())); |
159 } | 159 } |
160 | 160 |
161 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Deny) { | 161 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Deny) { |
162 // Canceling the infobar should deny permission to access the PPAPI broker. | 162 // Canceling the infobar should deny permission to access the PPAPI broker. |
163 InfoBarObserver observer; | 163 InfoBarObserver observer(this); |
164 observer.ExpectInfoBarAndAccept(false); | 164 observer.ExpectInfoBarAndAccept(false); |
165 | 165 |
166 // PPB_Broker_Trusted::IsAllowed should return false before and after the | 166 // PPB_Broker_Trusted::IsAllowed should return false before and after the |
167 // infobar is popped. | 167 // infobar is popped. |
168 RunTest("Broker_IsAllowedPermissionDenied"); | 168 RunTest("Broker_IsAllowedPermissionDenied"); |
169 RunTest("Broker_ConnectPermissionDenied"); | 169 RunTest("Broker_ConnectPermissionDenied"); |
170 RunTest("Broker_IsAllowedPermissionDenied"); | 170 RunTest("Broker_IsAllowedPermissionDenied"); |
171 | 171 |
172 // It should also set a content settings exception for the site. | 172 // It should also set a content settings exception for the site. |
173 GURL url = GetTestFileUrl("Broker_ConnectPermissionDenied"); | 173 GURL url = GetTestFileUrl("Broker_ConnectPermissionDenied"); |
174 HostContentSettingsMap* content_settings = | 174 HostContentSettingsMap* content_settings = |
175 browser()->profile()->GetHostContentSettingsMap(); | 175 browser()->profile()->GetHostContentSettingsMap(); |
176 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 176 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
177 content_settings->GetContentSetting( | 177 content_settings->GetContentSetting( |
178 url, url, CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string())); | 178 url, url, CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string())); |
179 } | 179 } |
180 | 180 |
181 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Blocked) { | 181 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Blocked) { |
182 // Block access to the PPAPI broker. | 182 // Block access to the PPAPI broker. |
183 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( | 183 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( |
184 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, CONTENT_SETTING_BLOCK); | 184 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, CONTENT_SETTING_BLOCK); |
185 | 185 |
186 // We shouldn't see an infobar. | 186 // We shouldn't see an infobar. |
187 InfoBarObserver observer; | 187 InfoBarObserver observer(this); |
188 | 188 |
189 RunTest("Broker_ConnectPermissionDenied"); | 189 RunTest("Broker_ConnectPermissionDenied"); |
190 RunTest("Broker_IsAllowedPermissionDenied"); | 190 RunTest("Broker_IsAllowedPermissionDenied"); |
191 } | 191 } |
192 | 192 |
193 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Allowed) { | 193 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Allowed) { |
194 // Always allow access to the PPAPI broker. | 194 // Always allow access to the PPAPI broker. |
195 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( | 195 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( |
196 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, CONTENT_SETTING_ALLOW); | 196 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, CONTENT_SETTING_ALLOW); |
197 | 197 |
198 // We shouldn't see an infobar. | 198 // We shouldn't see an infobar. |
199 InfoBarObserver observer; | 199 InfoBarObserver observer(this); |
200 | 200 |
201 RunTest("Broker_ConnectPermissionGranted"); | 201 RunTest("Broker_ConnectPermissionGranted"); |
202 RunTest("Broker_IsAllowedPermissionGranted"); | 202 RunTest("Broker_IsAllowedPermissionGranted"); |
203 } | 203 } |
204 | 204 |
205 TEST_PPAPI_IN_PROCESS(Console) | 205 TEST_PPAPI_IN_PROCESS(Console) |
206 TEST_PPAPI_OUT_OF_PROCESS(Console) | 206 TEST_PPAPI_OUT_OF_PROCESS(Console) |
207 TEST_PPAPI_NACL(Console) | 207 TEST_PPAPI_NACL(Console) |
208 | 208 |
209 TEST_PPAPI_IN_PROCESS(Core) | 209 TEST_PPAPI_IN_PROCESS(Core) |
(...skipping 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1539 LIST_TEST(FlashDRM_GetHmonitor) | 1539 LIST_TEST(FlashDRM_GetHmonitor) |
1540 LIST_TEST(FlashDRM_GetVoucherFile)); | 1540 LIST_TEST(FlashDRM_GetVoucherFile)); |
1541 } | 1541 } |
1542 | 1542 |
1543 TEST_PPAPI_IN_PROCESS(TalkPrivate) | 1543 TEST_PPAPI_IN_PROCESS(TalkPrivate) |
1544 TEST_PPAPI_OUT_OF_PROCESS(TalkPrivate) | 1544 TEST_PPAPI_OUT_OF_PROCESS(TalkPrivate) |
1545 | 1545 |
1546 #if defined(OS_CHROMEOS) | 1546 #if defined(OS_CHROMEOS) |
1547 TEST_PPAPI_OUT_OF_PROCESS(OutputProtectionPrivate) | 1547 TEST_PPAPI_OUT_OF_PROCESS(OutputProtectionPrivate) |
1548 #endif | 1548 #endif |
OLD | NEW |