Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(409)

Side by Side Diff: chrome/test/ppapi/ppapi_browsertest.cc

Issue 11316316: Implement an IsAllowed function in the pepper PPB_Broker_Trusted API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/chrome_browser.gypi ('k') | chrome/test/ppapi/ppapi_test.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
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;
144 observer.ExpectInfoBarAndAccept(true); 144 observer.ExpectInfoBarAndAccept(true);
145 145
146 GURL url = GetTestFileUrl("Broker_ConnectPermissionGranted"); 146 // PPB_Broker_Trusted::IsAllowed should return false before the infobar is
147 RunTestURL(url); 147 // popped and true after the infobar is popped.
148 RunTest("Broker_IsAllowedPermissionDenied");
149 RunTest("Broker_ConnectPermissionGranted");
150 RunTest("Broker_IsAllowedPermissionGranted");
148 151
149 // 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");
150 HostContentSettingsMap* content_settings = 154 HostContentSettingsMap* content_settings =
151 browser()->profile()->GetHostContentSettingsMap(); 155 browser()->profile()->GetHostContentSettingsMap();
152 EXPECT_EQ(CONTENT_SETTING_ALLOW, 156 EXPECT_EQ(CONTENT_SETTING_ALLOW,
153 content_settings->GetContentSetting( 157 content_settings->GetContentSetting(
154 url, url, CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string())); 158 url, url, CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string()));
155 } 159 }
156 160
157 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Deny) { 161 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Deny) {
158 // Canceling the infobar should deny permission to access the PPAPI broker. 162 // Canceling the infobar should deny permission to access the PPAPI broker.
159 InfoBarObserver observer; 163 InfoBarObserver observer;
160 observer.ExpectInfoBarAndAccept(false); 164 observer.ExpectInfoBarAndAccept(false);
161 165
162 GURL url = GetTestFileUrl("Broker_ConnectPermissionDenied"); 166 // PPB_Broker_Trusted::IsAllowed should return false before and after the
163 RunTestURL(url); 167 // infobar is popped.
168 RunTest("Broker_IsAllowedPermissionDenied");
169 RunTest("Broker_ConnectPermissionDenied");
170 RunTest("Broker_IsAllowedPermissionDenied");
164 171
165 // 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");
166 HostContentSettingsMap* content_settings = 174 HostContentSettingsMap* content_settings =
167 browser()->profile()->GetHostContentSettingsMap(); 175 browser()->profile()->GetHostContentSettingsMap();
168 EXPECT_EQ(CONTENT_SETTING_BLOCK, 176 EXPECT_EQ(CONTENT_SETTING_BLOCK,
169 content_settings->GetContentSetting( 177 content_settings->GetContentSetting(
170 url, url, CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string())); 178 url, url, CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string()));
171 } 179 }
172 180
173 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Blocked) { 181 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Blocked) {
174 // Block access to the PPAPI broker. 182 // Block access to the PPAPI broker.
175 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( 183 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
176 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, CONTENT_SETTING_BLOCK); 184 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, CONTENT_SETTING_BLOCK);
177 185
178 // We shouldn't see an infobar. 186 // We shouldn't see an infobar.
179 InfoBarObserver observer; 187 InfoBarObserver observer;
180 188
181 RunTest("Broker_ConnectPermissionDenied"); 189 RunTest("Broker_ConnectPermissionDenied");
190 RunTest("Broker_IsAllowedPermissionDenied");
182 } 191 }
183 192
184 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Allowed) { 193 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Allowed) {
185 // Always allow access to the PPAPI broker. 194 // Always allow access to the PPAPI broker.
186 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( 195 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
187 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, CONTENT_SETTING_ALLOW); 196 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, CONTENT_SETTING_ALLOW);
188 197
189 // We shouldn't see an infobar. 198 // We shouldn't see an infobar.
190 InfoBarObserver observer; 199 InfoBarObserver observer;
191 200
192 RunTest("Broker_ConnectPermissionGranted"); 201 RunTest("Broker_ConnectPermissionGranted");
202 RunTest("Broker_IsAllowedPermissionGranted");
193 } 203 }
194 204
195 TEST_PPAPI_IN_PROCESS(Core) 205 TEST_PPAPI_IN_PROCESS(Core)
196 TEST_PPAPI_OUT_OF_PROCESS(Core) 206 TEST_PPAPI_OUT_OF_PROCESS(Core)
197 TEST_PPAPI_NACL_VIA_HTTP(Core) 207 TEST_PPAPI_NACL_VIA_HTTP(Core)
198 208
199 #if defined(OS_CHROMEOS) 209 #if defined(OS_CHROMEOS)
200 #define MAYBE_InputEvent InputEvent 210 #define MAYBE_InputEvent InputEvent
201 #elif defined(OS_LINUX) 211 #elif defined(OS_LINUX)
202 // Times out on Linux. http://crbug.com/108859 212 // Times out on Linux. http://crbug.com/108859
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 #define MAYBE_FlashFullscreen DISABLED_FlashFullscreen 904 #define MAYBE_FlashFullscreen DISABLED_FlashFullscreen
895 #else 905 #else
896 #define MAYBE_FlashFullscreen FlashFullscreen 906 #define MAYBE_FlashFullscreen FlashFullscreen
897 #endif 907 #endif
898 TEST_PPAPI_OUT_OF_PROCESS(MAYBE_FlashFullscreen) 908 TEST_PPAPI_OUT_OF_PROCESS(MAYBE_FlashFullscreen)
899 909
900 TEST_PPAPI_IN_PROCESS(TalkPrivate) 910 TEST_PPAPI_IN_PROCESS(TalkPrivate)
901 TEST_PPAPI_OUT_OF_PROCESS(TalkPrivate) 911 TEST_PPAPI_OUT_OF_PROCESS(TalkPrivate)
902 912
903 #endif // ADDRESS_SANITIZER 913 #endif // ADDRESS_SANITIZER
OLDNEW
« no previous file with comments | « chrome/chrome_browser.gypi ('k') | chrome/test/ppapi/ppapi_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698