Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / test / ppapi / ppapi_browsertest.cc
blobaf818f95ceb33f951c8c62f92c2aa5db66afbe67
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
3 // found in the LICENSE file.
5 #include "base/path_service.h"
6 #include "base/test/test_timeouts.h"
7 #include "build/build_config.h"
8 #include "chrome/browser/extensions/extension_browsertest.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/browser_navigator.h"
12 #include "chrome/browser/ui/extensions/app_launch_params.h"
13 #include "chrome/browser/ui/extensions/application_launch.h"
14 #include "chrome/browser/ui/tabs/tab_strip_model.h"
15 #include "chrome/common/chrome_paths.h"
16 #include "chrome/test/base/ui_test_utils.h"
17 #include "chrome/test/nacl/nacl_browsertest_util.h"
18 #include "chrome/test/ppapi/ppapi_test.h"
19 #include "components/content_settings/core/browser/host_content_settings_map.h"
20 #include "components/nacl/common/nacl_switches.h"
21 #include "content/public/browser/web_contents.h"
22 #include "content/public/common/content_switches.h"
23 #include "content/public/common/url_constants.h"
24 #include "content/public/test/javascript_test_observer.h"
25 #include "content/public/test/test_renderer_host.h"
26 #include "extensions/common/constants.h"
27 #include "extensions/test/extension_test_message_listener.h"
28 #include "ppapi/shared_impl/test_utils.h"
30 using content::RenderViewHost;
32 // This macro finesses macro expansion to do what we want.
33 #define STRIP_PREFIXES(test_name) ppapi::StripTestPrefixes(#test_name)
34 // Turn the given token into a string. This allows us to use precompiler stuff
35 // to turn names into DISABLED_Foo, but still pass a string to RunTest.
36 #define STRINGIFY(test_name) #test_name
37 #define LIST_TEST(test_name) STRINGIFY(test_name) ","
39 // Use these macros to run the tests for a specific interface.
40 // Most interfaces should be tested with both macros.
41 #define TEST_PPAPI_OUT_OF_PROCESS(test_name) \
42 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, test_name) { \
43 RunTest(STRIP_PREFIXES(test_name)); \
46 // Similar macros that test over HTTP.
47 #define TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(test_name) \
48 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, test_name) { \
49 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
52 // Similar macros that test with an SSL server.
53 #define TEST_PPAPI_OUT_OF_PROCESS_WITH_SSL_SERVER(test_name) \
54 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, test_name) { \
55 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \
58 // Disable all NaCl tests for --disable-nacl flag and on Mac ASAN builds.
59 // Flaky on Mac ASAN:
60 // http://crbug.com/428670
62 #if defined(DISABLE_NACL) || (defined(OS_MACOSX) && defined(ADDRESS_SANITIZER))
64 #define MAYBE_PPAPI_NACL(test_name) DISABLED_##test_name
66 #define TEST_PPAPI_NACL(test_name)
67 #define TEST_PPAPI_NACL_DISALLOWED_SOCKETS(test_name)
68 #define TEST_PPAPI_NACL_WITH_SSL_SERVER(test_name)
69 #define TEST_PPAPI_NACL_SUBTESTS(test_name, run_statement)
71 #else
73 #define MAYBE_PPAPI_NACL(test_name) test_name
75 // NaCl based PPAPI tests
76 #define TEST_PPAPI_NACL(test_name) \
77 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, test_name) { \
78 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
79 } \
80 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, test_name) { \
81 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
82 } \
83 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest, \
84 MAYBE_PNACL_NONSFI(test_name)) { \
85 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
86 } \
87 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest, \
88 MAYBE_PNACL_TRANSITIONAL_NONSFI(test_name)) { \
89 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
92 // NaCl based PPAPI tests
93 #define TEST_PPAPI_NACL_SUBTESTS(test_name, run_statement) \
94 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, test_name) { \
95 run_statement; \
96 } \
97 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, test_name) { \
98 run_statement; \
99 } \
100 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest, \
101 MAYBE_PNACL_NONSFI(test_name)) { \
102 run_statement; \
104 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest, \
105 MAYBE_PNACL_TRANSITIONAL_NONSFI(test_name)) { \
106 run_statement; \
109 // NaCl based PPAPI tests with disallowed socket API
110 #define TEST_PPAPI_NACL_DISALLOWED_SOCKETS(test_name) \
111 IN_PROC_BROWSER_TEST_F(PPAPINaClTestDisallowedSockets, test_name) { \
112 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
115 // NaCl based PPAPI tests with SSL server
116 #define TEST_PPAPI_NACL_WITH_SSL_SERVER(test_name) \
117 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, test_name) { \
118 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \
120 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, test_name) { \
121 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \
123 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest, \
124 MAYBE_PNACL_NONSFI(test_name)) { \
125 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \
127 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest, \
128 MAYBE_PNACL_TRANSITIONAL_NONSFI(test_name)) { \
129 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \
133 #endif // DISABLE_NACL
136 // Interface tests.
139 // Flaky, http://crbug.com/111355
140 TEST_PPAPI_OUT_OF_PROCESS(DISABLED_Broker)
142 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Accept) {
143 // Accepting the infobar should grant permission to access the PPAPI broker.
144 InfoBarObserver observer(this);
145 observer.ExpectInfoBarAndAccept(true);
147 // PPB_Broker_Trusted::IsAllowed should return false before the infobar is
148 // popped and true after the infobar is popped.
149 RunTest("Broker_IsAllowedPermissionDenied");
150 RunTest("Broker_ConnectPermissionGranted");
151 RunTest("Broker_IsAllowedPermissionGranted");
153 // It should also set a content settings exception for the site.
154 GURL url = GetTestFileUrl("Broker_ConnectPermissionGranted");
155 HostContentSettingsMap* content_settings =
156 browser()->profile()->GetHostContentSettingsMap();
157 EXPECT_EQ(CONTENT_SETTING_ALLOW,
158 content_settings->GetContentSetting(
159 url, url, CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string()));
162 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Deny) {
163 // Canceling the infobar should deny permission to access the PPAPI broker.
164 InfoBarObserver observer(this);
165 observer.ExpectInfoBarAndAccept(false);
167 // PPB_Broker_Trusted::IsAllowed should return false before and after the
168 // infobar is popped.
169 RunTest("Broker_IsAllowedPermissionDenied");
170 RunTest("Broker_ConnectPermissionDenied");
171 RunTest("Broker_IsAllowedPermissionDenied");
173 // It should also set a content settings exception for the site.
174 GURL url = GetTestFileUrl("Broker_ConnectPermissionDenied");
175 HostContentSettingsMap* content_settings =
176 browser()->profile()->GetHostContentSettingsMap();
177 EXPECT_EQ(CONTENT_SETTING_BLOCK,
178 content_settings->GetContentSetting(
179 url, url, CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string()));
182 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Blocked) {
183 // Block access to the PPAPI broker.
184 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
185 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, CONTENT_SETTING_BLOCK);
187 // We shouldn't see an infobar.
188 InfoBarObserver observer(this);
190 RunTest("Broker_ConnectPermissionDenied");
191 RunTest("Broker_IsAllowedPermissionDenied");
194 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Allowed) {
195 // Always allow access to the PPAPI broker.
196 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
197 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, CONTENT_SETTING_ALLOW);
199 // We shouldn't see an infobar.
200 InfoBarObserver observer(this);
202 RunTest("Broker_ConnectPermissionGranted");
203 RunTest("Broker_IsAllowedPermissionGranted");
206 TEST_PPAPI_NACL(Console)
208 TEST_PPAPI_NACL(Core)
210 // Non-NaCl TraceEvent tests are in content/test/ppapi/ppapi_browsertest.cc.
211 TEST_PPAPI_NACL(TraceEvent)
213 TEST_PPAPI_NACL(InputEvent)
215 // Flaky on Linux and Windows. http://crbug.com/135403
216 #if defined(OS_LINUX) || defined(OS_WIN)
217 #define MAYBE_ImeInputEvent DISABLED_ImeInputEvent
218 #else
219 #define MAYBE_ImeInputEvent ImeInputEvent
220 #endif
222 TEST_PPAPI_OUT_OF_PROCESS(MAYBE_ImeInputEvent)
223 TEST_PPAPI_NACL(MAYBE_ImeInputEvent)
225 // Graphics2D_Dev isn't supported in NaCl, only test the other interfaces
226 // TODO(jhorwich) Enable when Graphics2D_Dev interfaces are proxied in NaCl.
227 TEST_PPAPI_NACL(Graphics2D_InvalidResource)
228 TEST_PPAPI_NACL(Graphics2D_InvalidSize)
229 TEST_PPAPI_NACL(Graphics2D_Humongous)
230 TEST_PPAPI_NACL(Graphics2D_InitToZero)
231 TEST_PPAPI_NACL(Graphics2D_Describe)
232 TEST_PPAPI_NACL(Graphics2D_Paint)
233 TEST_PPAPI_NACL(Graphics2D_Scroll)
234 TEST_PPAPI_NACL(Graphics2D_Replace)
235 TEST_PPAPI_NACL(Graphics2D_Flush)
236 TEST_PPAPI_NACL(Graphics2D_FlushOffscreenUpdate)
237 TEST_PPAPI_NACL(Graphics2D_BindNull)
239 #if defined(OS_WIN)
240 #if defined(USE_AURA)
241 // These tests fail with the test compositor which is what's used by default for
242 // browser tests on Windows Aura. Renable when the software compositor is
243 // available.
244 #define MAYBE_IN_Graphics3D DISABLED_Graphics3D
245 #define MAYBE_OUT_Graphics3D DISABLED_Graphics3D
246 #define MAYBE_NACL_Graphics3D DISABLED_Graphics3D
247 #else // defined(USE_AURA)
248 // In-process and NaCl tests are having flaky failures on Win: crbug.com/242252
249 #define MAYBE_IN_Graphics3D DISABLED_Graphics3D
250 #define MAYBE_OUT_Graphics3D Graphics3D
251 #define MAYBE_NACL_Graphics3D DISABLED_Graphics3D
252 #endif // defined(USE_AURA)
253 #elif defined(OS_MACOSX)
254 // These tests fail when using the legacy software mode. Reenable when the
255 // software compositor is enabled crbug.com/286038
256 #define MAYBE_IN_Graphics3D DISABLED_Graphics3D
257 #define MAYBE_OUT_Graphics3D DISABLED_Graphics3D
258 #define MAYBE_NACL_Graphics3D DISABLED_Graphics3D
259 #else
260 // The tests are failing in-process. crbug.com/280282
261 #define MAYBE_IN_Graphics3D DISABLED_Graphics3D
262 #define MAYBE_OUT_Graphics3D Graphics3D
263 #define MAYBE_NACL_Graphics3D Graphics3D
264 #endif
265 TEST_PPAPI_OUT_OF_PROCESS(MAYBE_OUT_Graphics3D)
266 TEST_PPAPI_NACL(MAYBE_NACL_Graphics3D)
268 TEST_PPAPI_NACL(ImageData)
270 // TCPSocket and TCPSocketPrivate tests.
271 #define RUN_TCPSOCKET_SUBTESTS \
272 RunTestViaHTTP( \
273 LIST_TEST(TCPSocket_Connect) \
274 LIST_TEST(TCPSocket_ReadWrite) \
275 LIST_TEST(TCPSocket_SetOption) \
276 LIST_TEST(TCPSocket_Listen) \
277 LIST_TEST(TCPSocket_Backlog) \
278 LIST_TEST(TCPSocket_Interface_1_0) \
281 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, TCPSocket) {
282 RUN_TCPSOCKET_SUBTESTS;
284 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_PPAPI_NACL(TCPSocket)) {
285 RUN_TCPSOCKET_SUBTESTS;
287 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, MAYBE_PPAPI_NACL(TCPSocket)) {
288 RUN_TCPSOCKET_SUBTESTS;
290 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
291 MAYBE_PNACL_NONSFI(TCPSocket)) {
292 RUN_TCPSOCKET_SUBTESTS;
294 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
295 MAYBE_PNACL_TRANSITIONAL_NONSFI(TCPSocket)) {
296 RUN_TCPSOCKET_SUBTESTS;
300 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(TCPServerSocketPrivate)
301 TEST_PPAPI_NACL(TCPServerSocketPrivate)
303 TEST_PPAPI_OUT_OF_PROCESS_WITH_SSL_SERVER(TCPSocketPrivate)
305 TEST_PPAPI_NACL_WITH_SSL_SERVER(TCPSocketPrivate)
307 TEST_PPAPI_OUT_OF_PROCESS_WITH_SSL_SERVER(TCPSocketPrivateTrusted)
309 // UDPSocket tests.
310 // UDPSocket_Broadcast is disabled for OSX because it requires root
311 // permissions on OSX 10.7+.
312 #if defined(OS_MACOSX)
313 #define MAYBE_UDPSocket_Broadcast DISABLED_UDPSocket_Broadcast
314 #else
315 #define MAYBE_UDPSocket_Broadcast UDPSocket_Broadcast
316 #endif
318 #define UDPSOCKET_TEST(_test) \
319 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, _test) { \
320 RunTestViaHTTP(LIST_TEST(_test)); \
322 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_PPAPI_NACL(_test)) { \
323 RunTestViaHTTP(LIST_TEST(_test)); \
325 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(_test)) { \
326 RunTestViaHTTP(LIST_TEST(_test)); \
328 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, MAYBE_PPAPI_NACL(_test)) { \
329 RunTestViaHTTP(LIST_TEST(_test)); \
331 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest, \
332 MAYBE_PNACL_NONSFI(_test)) { \
333 RunTestViaHTTP(LIST_TEST(_test)); \
335 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest, \
336 MAYBE_PNACL_TRANSITIONAL_NONSFI(_test)) { \
337 RunTestViaHTTP(LIST_TEST(_test)); \
340 // Instead of one single test for all UDPSocket features (like it is done for
341 // TCPSocket), split them into multiple, making it easier to isolate which tests
342 // are failing.
343 UDPSOCKET_TEST(UDPSocket_ReadWrite)
344 UDPSOCKET_TEST(UDPSocket_SetOption)
345 UDPSOCKET_TEST(UDPSocket_SetOption_1_0)
346 UDPSOCKET_TEST(UDPSocket_SetOption_1_1)
347 UDPSOCKET_TEST(MAYBE_UDPSocket_Broadcast)
348 UDPSOCKET_TEST(UDPSocket_ParallelSend)
349 UDPSOCKET_TEST(UDPSocket_Multicast)
351 // UDPSocketPrivate tests.
352 // UDPSocketPrivate_Broadcast is disabled for OSX because it requires root
353 // permissions on OSX 10.7+.
354 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(UDPSocketPrivate_Connect)
355 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(UDPSocketPrivate_ConnectFailure)
356 #if !defined(OS_MACOSX)
357 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(UDPSocketPrivate_Broadcast)
358 #endif // !defined(OS_MACOSX)
359 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(UDPSocketPrivate_SetSocketFeatureErrors)
360 TEST_PPAPI_NACL(UDPSocketPrivate_Connect)
361 TEST_PPAPI_NACL(UDPSocketPrivate_ConnectFailure)
362 #if !defined(OS_MACOSX)
363 TEST_PPAPI_NACL(UDPSocketPrivate_Broadcast)
364 #endif // !defined(OS_MACOSX)
365 TEST_PPAPI_NACL(UDPSocketPrivate_SetSocketFeatureErrors)
367 // Disallowed socket tests.
368 TEST_PPAPI_NACL_DISALLOWED_SOCKETS(HostResolverPrivateDisallowed)
369 TEST_PPAPI_NACL_DISALLOWED_SOCKETS(TCPServerSocketPrivateDisallowed)
370 TEST_PPAPI_NACL_DISALLOWED_SOCKETS(TCPSocketPrivateDisallowed)
371 TEST_PPAPI_NACL_DISALLOWED_SOCKETS(UDPSocketPrivateDisallowed)
373 // HostResolver and HostResolverPrivate tests.
374 #define RUN_HOST_RESOLVER_SUBTESTS \
375 RunTestViaHTTP( \
376 LIST_TEST(HostResolver_Empty) \
377 LIST_TEST(HostResolver_Resolve) \
378 LIST_TEST(HostResolver_ResolveIPv4) \
381 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, HostResolver) {
382 RUN_HOST_RESOLVER_SUBTESTS;
385 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_PPAPI_NACL(HostResolver)) {
386 RUN_HOST_RESOLVER_SUBTESTS;
388 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, MAYBE_PPAPI_NACL(HostResolver)) {
389 RUN_HOST_RESOLVER_SUBTESTS;
391 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
392 MAYBE_PNACL_NONSFI(HostResolver)) {
393 RUN_HOST_RESOLVER_SUBTESTS;
395 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
396 MAYBE_PNACL_TRANSITIONAL_NONSFI(HostResolver)) {
397 RUN_HOST_RESOLVER_SUBTESTS;
400 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(HostResolverPrivate_Resolve)
401 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(HostResolverPrivate_ResolveIPv4)
402 TEST_PPAPI_NACL(HostResolverPrivate_Resolve)
403 TEST_PPAPI_NACL(HostResolverPrivate_ResolveIPv4)
405 // URLLoader tests. These are split into multiple test fixtures because if we
406 // run them all together, they tend to time out.
407 #define RUN_URLLOADER_SUBTESTS_0 \
408 RunTestViaHTTP( \
409 LIST_TEST(URLLoader_BasicGET) \
410 LIST_TEST(URLLoader_BasicPOST) \
411 LIST_TEST(URLLoader_BasicFilePOST) \
412 LIST_TEST(URLLoader_BasicFileRangePOST) \
413 LIST_TEST(URLLoader_CompoundBodyPOST) \
416 #define RUN_URLLOADER_SUBTESTS_1 \
417 RunTestViaHTTP( \
418 LIST_TEST(URLLoader_EmptyDataPOST) \
419 LIST_TEST(URLLoader_BinaryDataPOST) \
420 LIST_TEST(URLLoader_CustomRequestHeader) \
421 LIST_TEST(URLLoader_FailsBogusContentLength) \
422 LIST_TEST(URLLoader_StreamToFile) \
425 // TODO(bbudge) Fix Javascript URLs for trusted loaders.
426 // http://crbug.com/103062
427 #define RUN_URLLOADER_SUBTESTS_2 \
428 RunTestViaHTTP( \
429 LIST_TEST(URLLoader_UntrustedSameOriginRestriction) \
430 LIST_TEST(URLLoader_UntrustedCrossOriginRequest) \
431 LIST_TEST(URLLoader_UntrustedJavascriptURLRestriction) \
432 LIST_TEST(DISABLED_URLLoader_TrustedJavascriptURLRestriction) \
435 #define RUN_URLLOADER_NACL_SUBTESTS_2 \
436 RunTestViaHTTP( \
437 LIST_TEST(URLLoader_UntrustedSameOriginRestriction) \
438 LIST_TEST(URLLoader_UntrustedCrossOriginRequest) \
439 LIST_TEST(URLLoader_UntrustedJavascriptURLRestriction) \
440 LIST_TEST(DISABLED_URLLoader_TrustedJavascriptURLRestriction) \
443 #define RUN_URLLOADER_SUBTESTS_3 \
444 RunTestViaHTTP( \
445 LIST_TEST(URLLoader_UntrustedHttpRequests) \
446 LIST_TEST(URLLoader_FollowURLRedirect) \
447 LIST_TEST(URLLoader_AuditURLRedirect) \
448 LIST_TEST(URLLoader_AbortCalls) \
449 LIST_TEST(URLLoader_UntendedLoad) \
450 LIST_TEST(URLLoader_PrefetchBufferThreshold) \
453 // Note: we do not support Trusted APIs in NaCl, so these will be skipped.
454 // XRequestedWithHeader isn't trusted per-se, but the header isn't provided
455 // for NaCl and thus must be skipped.
456 #define RUN_URLLOADER_TRUSTED_SUBTESTS \
457 RunTestViaHTTP( \
458 LIST_TEST(URLLoader_TrustedSameOriginRestriction) \
459 LIST_TEST(URLLoader_TrustedCrossOriginRequest) \
460 LIST_TEST(URLLoader_TrustedHttpRequests) \
461 LIST_TEST(URLLoader_XRequestedWithHeader) \
464 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, URLLoader0) {
465 RUN_URLLOADER_SUBTESTS_0;
467 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, URLLoader1) {
468 RUN_URLLOADER_SUBTESTS_1;
470 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, URLLoader2) {
471 RUN_URLLOADER_SUBTESTS_2;
473 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, URLLoader3) {
474 RUN_URLLOADER_SUBTESTS_3;
476 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, URLLoaderTrusted) {
477 RUN_URLLOADER_TRUSTED_SUBTESTS;
479 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_PPAPI_NACL(URLLoader0)) {
480 RUN_URLLOADER_SUBTESTS_0;
482 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_PPAPI_NACL(URLLoader1)) {
483 RUN_URLLOADER_SUBTESTS_1;
486 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_PPAPI_NACL(URLLoader2)) {
487 RUN_URLLOADER_SUBTESTS_2;
489 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_PPAPI_NACL(URLLoader3)) {
490 RUN_URLLOADER_SUBTESTS_3;
493 // Flaky on 32-bit linux bot; http://crbug.com/308906
494 #if defined(OS_LINUX) && defined(ARCH_CPU_X86)
495 #define MAYBE_URLLoader_BasicFilePOST DISABLED_URLLoader_BasicFilePOST
496 #else
497 #define MAYBE_URLLoader_BasicFilePOST URLLoader_BasicFilePOST
498 #endif
500 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, MAYBE_PPAPI_NACL(URLLoader0)) {
501 RUN_URLLOADER_SUBTESTS_0;
503 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, MAYBE_PPAPI_NACL(URLLoader1)) {
504 RUN_URLLOADER_SUBTESTS_1;
506 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, MAYBE_PPAPI_NACL(URLLoader2)) {
507 RUN_URLLOADER_SUBTESTS_2;
509 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, MAYBE_PPAPI_NACL(URLLoader3)) {
510 RUN_URLLOADER_SUBTESTS_3;
512 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
513 MAYBE_PNACL_NONSFI(URLLoader0)) {
514 RUN_URLLOADER_SUBTESTS_0;
516 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
517 MAYBE_PNACL_NONSFI(URLLoader1)) {
518 RUN_URLLOADER_SUBTESTS_1;
520 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
521 MAYBE_PNACL_NONSFI(URLLoader2)) {
522 RUN_URLLOADER_SUBTESTS_2;
524 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
525 MAYBE_PNACL_NONSFI(URLLoader3)) {
526 RUN_URLLOADER_SUBTESTS_3;
528 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
529 MAYBE_PNACL_TRANSITIONAL_NONSFI(URLLoader0)) {
530 RUN_URLLOADER_SUBTESTS_0;
532 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
533 MAYBE_PNACL_TRANSITIONAL_NONSFI(URLLoader1)) {
534 RUN_URLLOADER_SUBTESTS_1;
536 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
537 MAYBE_PNACL_TRANSITIONAL_NONSFI(URLLoader2)) {
538 RUN_URLLOADER_SUBTESTS_2;
540 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
541 MAYBE_PNACL_TRANSITIONAL_NONSFI(URLLoader3)) {
542 RUN_URLLOADER_SUBTESTS_3;
546 // URLRequestInfo tests.
547 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(URLRequest_CreateAndIsURLRequestInfo)
549 // Timing out on Windows. http://crbug.com/129571
550 #if defined(OS_WIN)
551 #define MAYBE_URLRequest_CreateAndIsURLRequestInfo \
552 DISABLED_URLRequest_CreateAndIsURLRequestInfo
553 #else
554 #define MAYBE_URLRequest_CreateAndIsURLRequestInfo \
555 URLRequest_CreateAndIsURLRequestInfo
556 #endif
557 TEST_PPAPI_NACL(MAYBE_URLRequest_CreateAndIsURLRequestInfo)
559 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(URLRequest_SetProperty)
560 TEST_PPAPI_NACL(URLRequest_SetProperty)
561 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(URLRequest_AppendDataToBody)
562 TEST_PPAPI_NACL(URLRequest_AppendDataToBody)
563 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(DISABLED_URLRequest_AppendFileToBody)
564 TEST_PPAPI_NACL(DISABLED_URLRequest_AppendFileToBody)
565 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(URLRequest_Stress)
566 TEST_PPAPI_NACL(URLRequest_Stress)
568 TEST_PPAPI_OUT_OF_PROCESS(PaintAggregator)
569 TEST_PPAPI_NACL(PaintAggregator)
571 // TODO(danakj): http://crbug.com/115286
572 TEST_PPAPI_NACL(DISABLED_Scrollbar)
574 TEST_PPAPI_NACL(Var)
576 TEST_PPAPI_NACL(VarResource)
578 // PostMessage tests.
579 #define RUN_POSTMESSAGE_SUBTESTS \
580 RunTestViaHTTP( \
581 LIST_TEST(PostMessage_SendInInit) \
582 LIST_TEST(PostMessage_SendingData) \
583 LIST_TEST(PostMessage_SendingString) \
584 LIST_TEST(PostMessage_SendingArrayBuffer) \
585 LIST_TEST(PostMessage_SendingArray) \
586 LIST_TEST(PostMessage_SendingDictionary) \
587 LIST_TEST(PostMessage_SendingResource) \
588 LIST_TEST(PostMessage_SendingComplexVar) \
589 LIST_TEST(PostMessage_MessageEvent) \
590 LIST_TEST(PostMessage_NoHandler) \
591 LIST_TEST(PostMessage_ExtraParam) \
592 LIST_TEST(PostMessage_NonMainThread) \
595 // Windows defines 'PostMessage', so we have to undef it.
596 #ifdef PostMessage
597 #undef PostMessage
598 #endif
600 #if defined(OS_WIN)
601 // http://crbug.com/95557
602 #define MAYBE_PostMessage DISABLED_PostMessage
603 #else
604 #define MAYBE_PostMessage PostMessage
605 #endif
606 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, MAYBE_PostMessage) {
607 RUN_POSTMESSAGE_SUBTESTS;
610 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_PPAPI_NACL(PostMessage)) {
611 RUN_POSTMESSAGE_SUBTESTS;
613 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, MAYBE_PPAPI_NACL(PostMessage)) {
614 RUN_POSTMESSAGE_SUBTESTS;
616 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
617 MAYBE_PNACL_NONSFI(PostMessage)) {
618 RUN_POSTMESSAGE_SUBTESTS;
620 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
621 MAYBE_PNACL_TRANSITIONAL_NONSFI(PostMessage)) {
622 RUN_POSTMESSAGE_SUBTESTS;
625 TEST_PPAPI_NACL(Memory)
627 // FileIO tests.
628 #define RUN_FILEIO_SUBTESTS \
629 RunTestViaHTTP( \
630 LIST_TEST(FileIO_Open) \
631 LIST_TEST(FileIO_OpenDirectory) \
632 LIST_TEST(FileIO_AbortCalls) \
633 LIST_TEST(FileIO_ParallelReads) \
634 LIST_TEST(FileIO_ParallelWrites) \
635 LIST_TEST(FileIO_NotAllowMixedReadWrite) \
636 LIST_TEST(FileIO_ReadWriteSetLength) \
637 LIST_TEST(FileIO_ReadToArrayWriteSetLength) \
638 LIST_TEST(FileIO_TouchQuery) \
641 #define RUN_FILEIO_PRIVATE_SUBTESTS \
642 RunTestViaHTTP( \
643 LIST_TEST(FileIO_RequestOSFileHandle) \
644 LIST_TEST(FileIO_RequestOSFileHandleWithOpenExclusive) \
645 LIST_TEST(FileIO_Mmap) \
648 IN_PROC_BROWSER_TEST_F(PPAPIPrivateTest, FileIO_Private) {
649 RUN_FILEIO_PRIVATE_SUBTESTS;
652 // See: crbug.com/421284
653 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, DISABLED_FileIO) {
654 RUN_FILEIO_SUBTESTS;
656 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPIPrivateTest, FileIO_Private) {
657 RUN_FILEIO_PRIVATE_SUBTESTS;
660 // http://crbug.com/313401
661 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, DISABLED_FileIO) {
662 RUN_FILEIO_SUBTESTS;
664 // http://crbug.com/313401
665 IN_PROC_BROWSER_TEST_F(PPAPIPrivateNaClNewlibTest,
666 DISABLED_NaCl_Newlib_FileIO_Private) {
667 RUN_FILEIO_PRIVATE_SUBTESTS;
670 // http://crbug.com/313205
671 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, DISABLED_FileIO) {
672 RUN_FILEIO_SUBTESTS;
674 IN_PROC_BROWSER_TEST_F(PPAPIPrivateNaClPNaClTest,
675 DISABLED_PNaCl_FileIO_Private) {
676 RUN_FILEIO_PRIVATE_SUBTESTS;
679 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest, MAYBE_PNACL_NONSFI(FileIO)) {
680 RUN_FILEIO_SUBTESTS;
682 IN_PROC_BROWSER_TEST_F(PPAPIPrivateNaClPNaClNonSfiTest,
683 MAYBE_PNACL_NONSFI(FILEIO_Private)) {
684 RUN_FILEIO_PRIVATE_SUBTESTS;
687 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
688 MAYBE_PNACL_TRANSITIONAL_NONSFI(FileIO)) {
689 RUN_FILEIO_SUBTESTS;
691 IN_PROC_BROWSER_TEST_F(PPAPIPrivateNaClPNaClTransitionalNonSfiTest,
692 MAYBE_PNACL_TRANSITIONAL_NONSFI(FILEIO_Private)) {
693 RUN_FILEIO_PRIVATE_SUBTESTS;
696 // FileRef tests.
697 #define RUN_FILEREF_SUBTESTS_1 \
698 RunTestViaHTTP( \
699 LIST_TEST(FileRef_Create) \
700 LIST_TEST(FileRef_GetFileSystemType) \
701 LIST_TEST(FileRef_GetName) \
702 LIST_TEST(FileRef_GetPath) \
703 LIST_TEST(FileRef_GetParent) \
704 LIST_TEST(FileRef_MakeDirectory) \
707 #define RUN_FILEREF_SUBTESTS_2 \
708 RunTestViaHTTP( \
709 LIST_TEST(FileRef_QueryAndTouchFile) \
710 LIST_TEST(FileRef_DeleteFileAndDirectory) \
711 LIST_TEST(FileRef_RenameFileAndDirectory) \
712 LIST_TEST(FileRef_Query) \
713 LIST_TEST(FileRef_FileNameEscaping) \
716 // Note, the FileRef tests are split into two, because all of them together
717 // sometimes take too long on windows: crbug.com/336999
718 // FileRef_ReadDirectoryEntries is flaky, so left out. See crbug.com/241646.
719 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, FileRef1) {
720 RUN_FILEREF_SUBTESTS_1;
722 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, FileRef2) {
723 RUN_FILEREF_SUBTESTS_2;
726 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_PPAPI_NACL(FileRef1)) {
727 RUN_FILEREF_SUBTESTS_1;
729 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_PPAPI_NACL(FileRef2)) {
730 RUN_FILEREF_SUBTESTS_2;
732 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, MAYBE_PPAPI_NACL(FileRef1)) {
733 RUN_FILEREF_SUBTESTS_1;
735 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, MAYBE_PPAPI_NACL(FileRef2)) {
736 RUN_FILEREF_SUBTESTS_2;
738 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
739 MAYBE_PNACL_NONSFI(FileRef1)) {
740 RUN_FILEREF_SUBTESTS_1;
742 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
743 MAYBE_PNACL_NONSFI(FileRef2)) {
744 RUN_FILEREF_SUBTESTS_2;
746 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
747 MAYBE_PNACL_TRANSITIONAL_NONSFI(FileRef1)) {
748 RUN_FILEREF_SUBTESTS_1;
750 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
751 MAYBE_PNACL_TRANSITIONAL_NONSFI(FileRef2)) {
752 RUN_FILEREF_SUBTESTS_2;
755 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(FileSystem)
757 // PPAPINaClTest.FileSystem times out consistently on Windows and Mac.
758 // http://crbug.com/130372
759 #if defined(OS_MACOSX) || defined(OS_WIN)
760 #define MAYBE_FileSystem DISABLED_FileSystem
761 #else
762 #define MAYBE_FileSystem FileSystem
763 #endif
765 TEST_PPAPI_NACL(MAYBE_FileSystem)
767 #if defined(OS_MACOSX)
768 // http://crbug.com/103912
769 #define MAYBE_Fullscreen DISABLED_Fullscreen
770 #elif defined(OS_LINUX)
771 // http://crbug.com/146008
772 #define MAYBE_Fullscreen DISABLED_Fullscreen
773 #elif defined(OS_WIN)
774 // http://crbug.com/342269
775 #define MAYBE_Fullscreen DISABLED_Fullscreen
776 #else
777 #define MAYBE_Fullscreen Fullscreen
778 #endif
780 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(MAYBE_Fullscreen)
781 TEST_PPAPI_NACL(MAYBE_Fullscreen)
783 TEST_PPAPI_OUT_OF_PROCESS(X509CertificatePrivate)
785 TEST_PPAPI_OUT_OF_PROCESS(UMA)
786 TEST_PPAPI_NACL(UMA)
788 // NetAddress tests.
789 #define RUN_NETADDRESS_SUBTESTS \
790 RunTestViaHTTP( \
791 LIST_TEST(NetAddress_IPv4Address) \
792 LIST_TEST(NetAddress_IPv6Address) \
793 LIST_TEST(NetAddress_DescribeAsString) \
796 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, NetAddress) {
797 RUN_NETADDRESS_SUBTESTS;
799 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, NetAddress) {
800 RUN_NETADDRESS_SUBTESTS;
802 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, NetAddress) {
803 RUN_NETADDRESS_SUBTESTS;
805 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
806 MAYBE_PNACL_NONSFI(NetAddress)) {
807 RUN_NETADDRESS_SUBTESTS;
809 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
810 MAYBE_PNACL_TRANSITIONAL_NONSFI(NetAddress)) {
811 RUN_NETADDRESS_SUBTESTS;
814 // NetAddressPrivate tests.
815 #define RUN_NETADDRESS_PRIVATE_SUBTESTS \
816 RunTestViaHTTP( \
817 LIST_TEST(NetAddressPrivate_AreEqual) \
818 LIST_TEST(NetAddressPrivate_AreHostsEqual) \
819 LIST_TEST(NetAddressPrivate_Describe) \
820 LIST_TEST(NetAddressPrivate_ReplacePort) \
821 LIST_TEST(NetAddressPrivate_GetAnyAddress) \
822 LIST_TEST(NetAddressPrivate_DescribeIPv6) \
823 LIST_TEST(NetAddressPrivate_GetFamily) \
824 LIST_TEST(NetAddressPrivate_GetPort) \
825 LIST_TEST(NetAddressPrivate_GetAddress) \
826 LIST_TEST(NetAddressPrivate_GetScopeID) \
829 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, NetAddressPrivate) {
830 RUN_NETADDRESS_PRIVATE_SUBTESTS;
833 #define RUN_NETADDRESS_PRIVATE_UNTRUSTED_SUBTESTS \
834 RunTestViaHTTP( \
835 LIST_TEST(NetAddressPrivateUntrusted_AreEqual) \
836 LIST_TEST(NetAddressPrivateUntrusted_AreHostsEqual) \
837 LIST_TEST(NetAddressPrivateUntrusted_Describe) \
838 LIST_TEST(NetAddressPrivateUntrusted_ReplacePort) \
839 LIST_TEST(NetAddressPrivateUntrusted_GetAnyAddress) \
840 LIST_TEST(NetAddressPrivateUntrusted_GetFamily) \
841 LIST_TEST(NetAddressPrivateUntrusted_GetPort) \
842 LIST_TEST(NetAddressPrivateUntrusted_GetAddress) \
845 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, NetAddressPrivate) {
846 RUN_NETADDRESS_PRIVATE_UNTRUSTED_SUBTESTS;
848 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, NetAddressPrivate) {
849 RUN_NETADDRESS_PRIVATE_UNTRUSTED_SUBTESTS;
851 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
852 MAYBE_PNACL_NONSFI(NetAddressPrivate)) {
853 RUN_NETADDRESS_PRIVATE_UNTRUSTED_SUBTESTS;
855 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
856 MAYBE_PNACL_TRANSITIONAL_NONSFI(NetAddressPrivate)) {
857 RUN_NETADDRESS_PRIVATE_UNTRUSTED_SUBTESTS;
860 // NetworkMonitor tests.
861 #define RUN_NETWORK_MONITOR_SUBTESTS \
862 RunTestViaHTTP( \
863 LIST_TEST(NetworkMonitor_Basic) \
864 LIST_TEST(NetworkMonitor_2Monitors) \
865 LIST_TEST(NetworkMonitor_DeleteInCallback) \
868 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, NetworkMonitor) {
869 RUN_NETWORK_MONITOR_SUBTESTS;
871 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, NetworkMonitor) {
872 RUN_NETWORK_MONITOR_SUBTESTS;
874 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, NetworkMonitor) {
875 RUN_NETWORK_MONITOR_SUBTESTS;
877 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
878 MAYBE_PNACL_NONSFI(NetworkMonitor)) {
879 RUN_NETWORK_MONITOR_SUBTESTS;
881 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
882 MAYBE_PNACL_TRANSITIONAL_NONSFI(NetworkMonitor)) {
883 RUN_NETWORK_MONITOR_SUBTESTS;
886 // Flash tests.
887 #define RUN_FLASH_SUBTESTS \
888 RunTestViaHTTP( \
889 LIST_TEST(Flash_SetInstanceAlwaysOnTop) \
890 LIST_TEST(Flash_GetCommandLineArgs) \
893 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, Flash) {
894 RUN_FLASH_SUBTESTS;
897 // In-process WebSocket tests. Note, the WebSocket tests are split into two,
898 // because all of them together sometimes take too long on windows:
899 // crbug.com/336999
900 #define RUN_WEBSOCKET_SUBTESTS_1 \
901 RunTestWithWebSocketServer( \
902 LIST_TEST(WebSocket_IsWebSocket) \
903 LIST_TEST(WebSocket_UninitializedPropertiesAccess) \
904 LIST_TEST(WebSocket_InvalidConnect) \
905 LIST_TEST(WebSocket_Protocols) \
906 LIST_TEST(WebSocket_GetURL) \
907 LIST_TEST(WebSocket_ValidConnect) \
908 LIST_TEST(WebSocket_InvalidClose) \
909 LIST_TEST(WebSocket_ValidClose) \
910 LIST_TEST(WebSocket_GetProtocol) \
911 LIST_TEST(WebSocket_TextSendReceive) \
912 LIST_TEST(WebSocket_BinarySendReceive) \
913 LIST_TEST(WebSocket_StressedSendReceive) \
914 LIST_TEST(WebSocket_BufferedAmount) \
917 #define RUN_WEBSOCKET_SUBTESTS_2 \
918 RunTestWithWebSocketServer( \
919 LIST_TEST(WebSocket_AbortCallsWithCallback) \
920 LIST_TEST(WebSocket_AbortSendMessageCall) \
921 LIST_TEST(WebSocket_AbortCloseCall) \
922 LIST_TEST(WebSocket_AbortReceiveMessageCall) \
923 LIST_TEST(WebSocket_ClosedFromServerWhileSending) \
924 LIST_TEST(WebSocket_CcInterfaces) \
925 LIST_TEST(WebSocket_UtilityInvalidConnect) \
926 LIST_TEST(WebSocket_UtilityProtocols) \
927 LIST_TEST(WebSocket_UtilityGetURL) \
928 LIST_TEST(WebSocket_UtilityValidConnect) \
929 LIST_TEST(WebSocket_UtilityInvalidClose) \
930 LIST_TEST(WebSocket_UtilityValidClose) \
931 LIST_TEST(WebSocket_UtilityGetProtocol) \
932 LIST_TEST(WebSocket_UtilityTextSendReceive) \
933 LIST_TEST(WebSocket_UtilityBinarySendReceive) \
934 LIST_TEST(WebSocket_UtilityBufferedAmount) \
937 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, WebSocket1) {
938 RUN_WEBSOCKET_SUBTESTS_1;
940 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, WebSocket2) {
941 RUN_WEBSOCKET_SUBTESTS_2;
943 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, WebSocket1) {
944 RUN_WEBSOCKET_SUBTESTS_1;
946 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, WebSocket2) {
947 RUN_WEBSOCKET_SUBTESTS_2;
949 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, WebSocket1) {
950 RUN_WEBSOCKET_SUBTESTS_1;
952 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, WebSocket2) {
953 RUN_WEBSOCKET_SUBTESTS_2;
955 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
956 MAYBE_PNACL_NONSFI(WebSocket1)) {
957 RUN_WEBSOCKET_SUBTESTS_1;
959 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
960 MAYBE_PNACL_NONSFI(WebSocket2)) {
961 RUN_WEBSOCKET_SUBTESTS_2;
963 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
964 MAYBE_PNACL_TRANSITIONAL_NONSFI(WebSocket1)) {
965 RUN_WEBSOCKET_SUBTESTS_1;
967 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
968 MAYBE_PNACL_TRANSITIONAL_NONSFI(WebSocket2)) {
969 RUN_WEBSOCKET_SUBTESTS_2;
972 // AudioConfig tests
973 #define RUN_AUDIO_CONFIG_SUBTESTS \
974 RunTestViaHTTP( \
975 LIST_TEST(AudioConfig_RecommendSampleRate) \
976 LIST_TEST(AudioConfig_ValidConfigs) \
977 LIST_TEST(AudioConfig_InvalidConfigs) \
980 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, AudioConfig) {
981 RUN_AUDIO_CONFIG_SUBTESTS;
983 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, AudioConfig) {
984 RUN_AUDIO_CONFIG_SUBTESTS;
986 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(AudioConfig)) {
987 RUN_AUDIO_CONFIG_SUBTESTS;
989 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, AudioConfig) {
990 RUN_AUDIO_CONFIG_SUBTESTS;
992 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
993 MAYBE_PNACL_NONSFI(AudioConfig)) {
994 RUN_AUDIO_CONFIG_SUBTESTS;
996 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
997 MAYBE_PNACL_TRANSITIONAL_NONSFI(AudioConfig)) {
998 RUN_AUDIO_CONFIG_SUBTESTS;
1001 // PPB_Audio tests.
1002 #define RUN_AUDIO_SUBTESTS \
1003 RunTestViaHTTP( \
1004 LIST_TEST(Audio_Creation) \
1005 LIST_TEST(Audio_DestroyNoStop) \
1006 LIST_TEST(Audio_Failures) \
1007 LIST_TEST(Audio_AudioCallback1) \
1008 LIST_TEST(Audio_AudioCallback2) \
1009 LIST_TEST(Audio_AudioCallback3) \
1010 LIST_TEST(Audio_AudioCallback4) \
1013 #if defined(OS_LINUX)
1014 // http://crbug.com/396464
1015 #define MAYBE_Audio DISABLED_Audio
1016 #else
1017 #define MAYBE_Audio Audio
1018 #endif
1019 // PPB_Audio is not supported in-process.
1020 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, MAYBE_Audio) {
1021 RUN_AUDIO_SUBTESTS;
1023 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, Audio) {
1024 RUN_AUDIO_SUBTESTS;
1026 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(Audio)) {
1027 RUN_AUDIO_SUBTESTS;
1029 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, Audio) {
1030 RUN_AUDIO_SUBTESTS;
1032 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
1033 MAYBE_PNACL_NONSFI(Audio)) {
1034 RUN_AUDIO_SUBTESTS;
1036 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
1037 MAYBE_PNACL_TRANSITIONAL_NONSFI(Audio)) {
1038 RUN_AUDIO_SUBTESTS;
1041 #define RUN_AUDIO_THREAD_CREATOR_SUBTESTS \
1042 RunTestViaHTTP( \
1043 LIST_TEST(Audio_AudioThreadCreatorIsRequired) \
1044 LIST_TEST(Audio_AudioThreadCreatorIsCalled) \
1047 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, AudioThreadCreator) {
1048 RUN_AUDIO_THREAD_CREATOR_SUBTESTS;
1050 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(AudioThreadCreator)) {
1051 RUN_AUDIO_THREAD_CREATOR_SUBTESTS;
1053 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, AudioThreadCreator) {
1054 RUN_AUDIO_THREAD_CREATOR_SUBTESTS;
1056 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
1057 MAYBE_PNACL_NONSFI(AudioThreadCreator)) {
1058 RUN_AUDIO_THREAD_CREATOR_SUBTESTS;
1060 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
1061 MAYBE_PNACL_TRANSITIONAL_NONSFI(AudioThreadCreator)) {
1062 RUN_AUDIO_THREAD_CREATOR_SUBTESTS;
1065 TEST_PPAPI_OUT_OF_PROCESS(View_CreatedVisible);
1066 #if defined(OS_MACOSX)
1067 // http://crbug.com/474399
1068 #define MAYBE_View_CreatedVisible DISABLED_View_CreatedVisible
1069 #else
1070 #define MAYBE_View_CreatedVisible View_CreatedVisible
1071 #endif
1072 TEST_PPAPI_NACL(MAYBE_View_CreatedVisible);
1074 // This test ensures that plugins created in a background tab have their
1075 // initial visibility set to false. We don't bother testing in-process for this
1076 // custom test since the out of process code also exercises in-process.
1077 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, View_CreateInvisible) {
1078 // Make a second tab in the foreground.
1079 GURL url = GetTestFileUrl("View_CreatedInvisible");
1080 chrome::NavigateParams params(browser(), url, ui::PAGE_TRANSITION_LINK);
1081 params.disposition = NEW_BACKGROUND_TAB;
1082 ui_test_utils::NavigateToURL(&params);
1085 // This test messes with tab visibility so is custom.
1086 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, DISABLED_View_PageHideShow) {
1087 // The plugin will be loaded in the foreground tab and will send us a message.
1088 PPAPITestMessageHandler handler;
1089 content::JavascriptTestObserver observer(
1090 browser()->tab_strip_model()->GetActiveWebContents(),
1091 &handler);
1093 GURL url = GetTestFileUrl("View_PageHideShow");
1094 ui_test_utils::NavigateToURL(browser(), url);
1096 ASSERT_TRUE(observer.Run()) << handler.error_message();
1097 EXPECT_STREQ("TestPageHideShow:Created", handler.message().c_str());
1098 observer.Reset();
1100 // Make a new tab to cause the original one to hide, this should trigger the
1101 // next phase of the test.
1102 chrome::NavigateParams params(
1103 browser(), GURL(url::kAboutBlankURL), ui::PAGE_TRANSITION_LINK);
1104 params.disposition = NEW_FOREGROUND_TAB;
1105 ui_test_utils::NavigateToURL(&params);
1107 // Wait until the test acks that it got hidden.
1108 ASSERT_TRUE(observer.Run()) << handler.error_message();
1109 EXPECT_STREQ("TestPageHideShow:Hidden", handler.message().c_str());
1110 observer.Reset();
1112 // Switch back to the test tab.
1113 browser()->tab_strip_model()->ActivateTabAt(0, true);
1115 ASSERT_TRUE(observer.Run()) << handler.error_message();
1116 EXPECT_STREQ("PASS", handler.message().c_str());
1119 // Tests that if a plugin accepts touch events, the browser knows to send touch
1120 // events to the renderer.
1121 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, InputEvent_AcceptTouchEvent) {
1122 std::string positive_tests[] = { "InputEvent_AcceptTouchEvent_1",
1123 "InputEvent_AcceptTouchEvent_2",
1124 "InputEvent_AcceptTouchEvent_3",
1125 "InputEvent_AcceptTouchEvent_4"
1128 for (size_t i = 0; i < arraysize(positive_tests); ++i) {
1129 RenderViewHost* host = browser()->tab_strip_model()->
1130 GetActiveWebContents()->GetRenderViewHost();
1131 RunTest(positive_tests[i]);
1132 EXPECT_TRUE(content::RenderViewHostTester::HasTouchEventHandler(host));
1136 // View tests.
1137 #define RUN_VIEW_SUBTESTS \
1138 RunTestViaHTTP( \
1139 LIST_TEST(View_SizeChange) \
1140 LIST_TEST(View_ClipChange) \
1141 LIST_TEST(View_ScrollOffsetChange) \
1144 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, View) {
1145 RUN_VIEW_SUBTESTS;
1147 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, View) {
1148 RUN_VIEW_SUBTESTS;
1150 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, View) {
1151 RUN_VIEW_SUBTESTS;
1153 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest, MAYBE_PNACL_NONSFI(View)) {
1154 RUN_VIEW_SUBTESTS;
1156 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
1157 MAYBE_PNACL_TRANSITIONAL_NONSFI(View)) {
1158 RUN_VIEW_SUBTESTS;
1161 // FlashMessageLoop tests.
1162 #define RUN_FLASH_MESSAGE_LOOP_SUBTESTS \
1163 RunTest( \
1164 LIST_TEST(FlashMessageLoop_Basics) \
1165 LIST_TEST(FlashMessageLoop_RunWithoutQuit) \
1168 #if defined(OS_LINUX) // Disabled due to flakiness http://crbug.com/316925
1169 #define MAYBE_FlashMessageLoop DISABLED_FlashMessageLoop
1170 #else
1171 #define MAYBE_FlashMessageLoop FlashMessageLoop
1172 #endif
1173 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, MAYBE_FlashMessageLoop) {
1174 RUN_FLASH_MESSAGE_LOOP_SUBTESTS;
1177 // The compositor test timeouts sometimes, so we have to split it to two
1178 // subtests.
1179 #define RUN_COMPOSITOR_SUBTESTS_0 \
1180 RunTestViaHTTP( \
1181 LIST_TEST(Compositor_BindUnbind) \
1182 LIST_TEST(Compositor_Release) \
1183 LIST_TEST(Compositor_ReleaseUnbound) \
1184 LIST_TEST(Compositor_ReleaseWithoutCommit) \
1185 LIST_TEST(Compositor_ReleaseWithoutCommitUnbound) \
1188 #define RUN_COMPOSITOR_SUBTESTS_1 \
1189 RunTestViaHTTP( \
1190 LIST_TEST(Compositor_CommitTwoTimesWithoutChange) \
1191 LIST_TEST(Compositor_CommitTwoTimesWithoutChangeUnbound) \
1192 LIST_TEST(Compositor_General) \
1193 LIST_TEST(Compositor_GeneralUnbound) \
1196 #if defined(OS_WIN)
1197 // This test fails with the test compositor which is what's used by default for
1198 // browser tests on Windows. Renable when the software compositor is available.
1199 #define MAYBE_Compositor0 DISABLED_Compositor0
1200 #define MAYBE_Compositor1 DISABLED_Compositor1
1201 #elif defined(OS_MACOSX)
1202 // This test fails when using the legacy software mode. Reenable when the
1203 // software compositor is enabled crbug.com/286038
1204 #define MAYBE_Compositor0 DISABLED_Compositor0
1205 #define MAYBE_Compositor1 DISABLED_Compositor1
1206 #else
1207 // flaky on Linux: http://crbug.com/396482
1208 #define MAYBE_Compositor0 DISABLED_Compositor0
1209 #define MAYBE_Compositor1 DISABLED_Compositor1
1210 #endif
1212 TEST_PPAPI_NACL_SUBTESTS(MAYBE_Compositor0, RUN_COMPOSITOR_SUBTESTS_0)
1213 TEST_PPAPI_NACL_SUBTESTS(MAYBE_Compositor1, RUN_COMPOSITOR_SUBTESTS_1)
1215 #if defined(OS_LINUX) || defined(OS_WIN) || defined(OS_CHROMEOS)
1216 // Flaky on ChromeOS, Linux and Windows (crbug.com/438729)
1217 #define MAYBE_MediaStreamAudioTrack DISABLED_MediaStreamAudioTrack
1218 #else
1219 #define MAYBE_MediaStreamAudioTrack MediaStreamAudioTrack
1220 #endif
1221 TEST_PPAPI_NACL(MAYBE_MediaStreamAudioTrack)
1223 TEST_PPAPI_NACL(MediaStreamVideoTrack)
1225 TEST_PPAPI_NACL(MouseCursor)
1227 TEST_PPAPI_NACL(NetworkProxy)
1229 TEST_PPAPI_NACL(TrueTypeFont)
1231 TEST_PPAPI_NACL(VideoDecoder)
1233 TEST_PPAPI_NACL(VideoEncoder)
1235 // VideoDestination doesn't work in content_browsertests.
1236 TEST_PPAPI_OUT_OF_PROCESS(VideoDestination)
1237 TEST_PPAPI_NACL(VideoDestination)
1239 // VideoSource doesn't work in content_browsertests.
1240 TEST_PPAPI_OUT_OF_PROCESS(VideoSource)
1241 TEST_PPAPI_NACL(VideoSource)
1243 // Printing doesn't work in content_browsertests.
1244 TEST_PPAPI_OUT_OF_PROCESS(Printing)
1246 TEST_PPAPI_NACL(MessageHandler)
1248 TEST_PPAPI_NACL(MessageLoop_Basics)
1249 TEST_PPAPI_NACL(MessageLoop_Post)
1251 // Going forward, Flash APIs will only work out-of-process.
1252 TEST_PPAPI_OUT_OF_PROCESS(Flash_GetLocalTimeZoneOffset)
1253 TEST_PPAPI_OUT_OF_PROCESS(Flash_GetProxyForURL)
1254 TEST_PPAPI_OUT_OF_PROCESS(Flash_GetSetting)
1255 TEST_PPAPI_OUT_OF_PROCESS(Flash_SetCrashData)
1256 // http://crbug.com/176822
1257 #if !defined(OS_WIN)
1258 TEST_PPAPI_OUT_OF_PROCESS(FlashClipboard)
1259 #endif
1260 TEST_PPAPI_OUT_OF_PROCESS(FlashFile)
1261 // Mac/Aura reach NOTIMPLEMENTED/time out.
1262 // mac: http://crbug.com/96767
1263 // aura: http://crbug.com/104384
1264 // cros: http://crbug.com/396502
1265 #if defined(OS_MACOSX) || defined(OS_CHROMEOS)
1266 #define MAYBE_FlashFullscreen DISABLED_FlashFullscreen
1267 #else
1268 #define MAYBE_FlashFullscreen FlashFullscreen
1269 #endif
1270 TEST_PPAPI_OUT_OF_PROCESS(MAYBE_FlashFullscreen)
1272 TEST_PPAPI_OUT_OF_PROCESS(PDF)
1274 // TODO(dalecurtis): Renable once the platform verification infobar has been
1275 // implemented; see http://crbug.com/270908
1276 // #if defined(OS_CHROMEOS)
1277 // TEST_PPAPI_OUT_OF_PROCESS(PlatformVerificationPrivate)
1278 // #endif
1280 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, FlashDRM) {
1281 RunTest(
1282 #if (defined(OS_WIN) && defined(ENABLE_RLZ)) || defined(OS_CHROMEOS)
1283 // Only implemented on Windows and ChromeOS currently.
1284 LIST_TEST(FlashDRM_GetDeviceID)
1285 #endif
1286 LIST_TEST(FlashDRM_GetHmonitor)
1287 LIST_TEST(FlashDRM_GetVoucherFile));
1290 #if defined(OS_CHROMEOS)
1291 TEST_PPAPI_OUT_OF_PROCESS(OutputProtectionPrivate)
1292 #endif
1294 #if !defined(DISABLE_NACL)
1295 class PackagedAppTest : public ExtensionBrowserTest {
1296 public:
1297 explicit PackagedAppTest(const std::string& toolchain)
1298 : toolchain_(toolchain) { }
1300 void LaunchTestingApp(const std::string& extension_dirname) {
1301 base::FilePath data_dir;
1302 ASSERT_TRUE(PathService::Get(chrome::DIR_GEN_TEST_DATA, &data_dir));
1303 base::FilePath app_dir = data_dir.AppendASCII("ppapi")
1304 .AppendASCII("tests")
1305 .AppendASCII("extensions")
1306 .AppendASCII(extension_dirname)
1307 .AppendASCII(toolchain_);
1309 const extensions::Extension* extension = LoadExtension(app_dir);
1310 ASSERT_TRUE(extension);
1312 AppLaunchParams params(browser()->profile(), extension,
1313 extensions::LAUNCH_CONTAINER_NONE, NEW_WINDOW,
1314 extensions::SOURCE_TEST);
1315 params.command_line = *base::CommandLine::ForCurrentProcess();
1316 OpenApplication(params);
1319 void RunTests(const std::string& extension_dirname) {
1320 ExtensionTestMessageListener listener("PASS", true);
1321 LaunchTestingApp(extension_dirname);
1322 EXPECT_TRUE(listener.WaitUntilSatisfied());
1324 protected:
1325 std::string toolchain_;
1328 class NewlibPackagedAppTest : public PackagedAppTest {
1329 public:
1330 NewlibPackagedAppTest() : PackagedAppTest("newlib") { }
1333 class NonSfiPackagedAppTest : public PackagedAppTest {
1334 public:
1335 NonSfiPackagedAppTest() : PackagedAppTest("nonsfi") { }
1337 void SetUpCommandLine(base::CommandLine* command_line) override {
1338 PackagedAppTest::SetUpCommandLine(command_line);
1339 command_line->AppendSwitch(switches::kEnableNaClNonSfiMode);
1343 // TODO(hidehiko): Remove this when clean-up to drop Non-SFI support from
1344 // nacl_helper is done. See NaClBrowserTestPnaclTransitionalNonSfi
1345 // for more details.
1346 class TransitionalNonSfiPackagedAppTest : public NonSfiPackagedAppTest {
1347 public:
1348 void SetUpCommandLine(base::CommandLine* command_line) override {
1349 NonSfiPackagedAppTest::SetUpCommandLine(command_line);
1350 command_line->AppendSwitchASCII(switches::kUseNaClHelperNonSfi,
1351 "false");
1355 // Load a packaged app, and wait for it to successfully post a "hello" message
1356 // back.
1357 IN_PROC_BROWSER_TEST_F(NewlibPackagedAppTest, SuccessfulLoad) {
1358 RunTests("packaged_app");
1361 IN_PROC_BROWSER_TEST_F(NonSfiPackagedAppTest,
1362 MAYBE_PNACL_NONSFI(SuccessfulLoad)) {
1363 RunTests("packaged_app");
1366 IN_PROC_BROWSER_TEST_F(TransitionalNonSfiPackagedAppTest,
1367 MAYBE_PNACL_TRANSITIONAL_NONSFI(SuccessfulLoad)) {
1368 RunTests("packaged_app");
1371 IN_PROC_BROWSER_TEST_F(NewlibPackagedAppTest, MulticastPermissions) {
1372 RunTests("multicast_permissions");
1375 IN_PROC_BROWSER_TEST_F(NewlibPackagedAppTest, NoSocketPermissions) {
1376 RunTests("no_socket_permissions");
1379 IN_PROC_BROWSER_TEST_F(NewlibPackagedAppTest, SocketPermissions) {
1380 RunTests("socket_permissions");
1383 #endif