bluetooth: Initial JNI setup for device/bluetooth.
[chromium-blink-merge.git] / chrome / test / ppapi / ppapi_browsertest.cc
blob8e0ed840f390f327531ecef1592a2531fb556412
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/ppapi_test_utils.h"
26 #include "content/public/test/test_renderer_host.h"
27 #include "extensions/common/constants.h"
28 #include "extensions/test/extension_test_message_listener.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 #if defined(DISABLE_NACL)
60 #define TEST_PPAPI_NACL(test_name)
61 #define TEST_PPAPI_NACL_DISALLOWED_SOCKETS(test_name)
62 #define TEST_PPAPI_NACL_WITH_SSL_SERVER(test_name)
63 #define TEST_PPAPI_NACL_SUBTESTS(test_name, run_statement)
65 #else
67 // NaCl based PPAPI tests
68 #define TEST_PPAPI_NACL(test_name) \
69 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, test_name) { \
70 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
71 } \
72 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, test_name) { \
73 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
74 } \
75 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest, \
76 MAYBE_PNACL_NONSFI(test_name)) { \
77 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
78 } \
79 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest, \
80 MAYBE_PNACL_TRANSITIONAL_NONSFI(test_name)) { \
81 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
84 // NaCl based PPAPI tests
85 #define TEST_PPAPI_NACL_SUBTESTS(test_name, run_statement) \
86 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, test_name) { \
87 run_statement; \
88 } \
89 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, test_name) { \
90 run_statement; \
91 } \
92 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest, \
93 MAYBE_PNACL_NONSFI(test_name)) { \
94 run_statement; \
95 } \
96 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest, \
97 MAYBE_PNACL_TRANSITIONAL_NONSFI(test_name)) { \
98 run_statement; \
101 // NaCl based PPAPI tests with disallowed socket API
102 #define TEST_PPAPI_NACL_DISALLOWED_SOCKETS(test_name) \
103 IN_PROC_BROWSER_TEST_F(PPAPINaClTestDisallowedSockets, test_name) { \
104 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
107 // NaCl based PPAPI tests with SSL server
108 #define TEST_PPAPI_NACL_WITH_SSL_SERVER(test_name) \
109 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, test_name) { \
110 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \
112 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, test_name) { \
113 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \
115 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest, \
116 MAYBE_PNACL_NONSFI(test_name)) { \
117 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \
119 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest, \
120 MAYBE_PNACL_TRANSITIONAL_NONSFI(test_name)) { \
121 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \
125 #endif // DISABLE_NACL
128 // Interface tests.
131 // Flaky, http://crbug.com/111355
132 TEST_PPAPI_OUT_OF_PROCESS(DISABLED_Broker)
134 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Accept) {
135 // Accepting the infobar should grant permission to access the PPAPI broker.
136 InfoBarObserver observer(this);
137 observer.ExpectInfoBarAndAccept(true);
139 // PPB_Broker_Trusted::IsAllowed should return false before the infobar is
140 // popped and true after the infobar is popped.
141 RunTest("Broker_IsAllowedPermissionDenied");
142 RunTest("Broker_ConnectPermissionGranted");
143 RunTest("Broker_IsAllowedPermissionGranted");
145 // It should also set a content settings exception for the site.
146 GURL url = GetTestFileUrl("Broker_ConnectPermissionGranted");
147 HostContentSettingsMap* content_settings =
148 browser()->profile()->GetHostContentSettingsMap();
149 EXPECT_EQ(CONTENT_SETTING_ALLOW,
150 content_settings->GetContentSetting(
151 url, url, CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string()));
154 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Deny) {
155 // Canceling the infobar should deny permission to access the PPAPI broker.
156 InfoBarObserver observer(this);
157 observer.ExpectInfoBarAndAccept(false);
159 // PPB_Broker_Trusted::IsAllowed should return false before and after the
160 // infobar is popped.
161 RunTest("Broker_IsAllowedPermissionDenied");
162 RunTest("Broker_ConnectPermissionDenied");
163 RunTest("Broker_IsAllowedPermissionDenied");
165 // It should also set a content settings exception for the site.
166 GURL url = GetTestFileUrl("Broker_ConnectPermissionDenied");
167 HostContentSettingsMap* content_settings =
168 browser()->profile()->GetHostContentSettingsMap();
169 EXPECT_EQ(CONTENT_SETTING_BLOCK,
170 content_settings->GetContentSetting(
171 url, url, CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string()));
174 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Blocked) {
175 // Block access to the PPAPI broker.
176 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
177 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, CONTENT_SETTING_BLOCK);
179 // We shouldn't see an infobar.
180 InfoBarObserver observer(this);
182 RunTest("Broker_ConnectPermissionDenied");
183 RunTest("Broker_IsAllowedPermissionDenied");
186 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Allowed) {
187 // Always allow access to the PPAPI broker.
188 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
189 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, CONTENT_SETTING_ALLOW);
191 // We shouldn't see an infobar.
192 InfoBarObserver observer(this);
194 RunTest("Broker_ConnectPermissionGranted");
195 RunTest("Broker_IsAllowedPermissionGranted");
198 TEST_PPAPI_NACL(Console)
200 TEST_PPAPI_NACL(Core)
202 // Non-NaCl TraceEvent tests are in content/test/ppapi/ppapi_browsertest.cc.
203 TEST_PPAPI_NACL(TraceEvent)
205 TEST_PPAPI_NACL(InputEvent)
207 // Flaky on Linux and Windows. http://crbug.com/135403
208 #if defined(OS_LINUX) || defined(OS_WIN)
209 #define MAYBE_ImeInputEvent DISABLED_ImeInputEvent
210 #else
211 #define MAYBE_ImeInputEvent ImeInputEvent
212 #endif
214 TEST_PPAPI_OUT_OF_PROCESS(MAYBE_ImeInputEvent)
215 TEST_PPAPI_NACL(MAYBE_ImeInputEvent)
217 // Graphics2D_Dev isn't supported in NaCl, only test the other interfaces
218 // TODO(jhorwich) Enable when Graphics2D_Dev interfaces are proxied in NaCl.
219 TEST_PPAPI_NACL(Graphics2D_InvalidResource)
220 TEST_PPAPI_NACL(Graphics2D_InvalidSize)
221 TEST_PPAPI_NACL(Graphics2D_Humongous)
222 TEST_PPAPI_NACL(Graphics2D_InitToZero)
223 TEST_PPAPI_NACL(Graphics2D_Describe)
224 TEST_PPAPI_NACL(Graphics2D_Paint)
225 TEST_PPAPI_NACL(Graphics2D_Scroll)
226 TEST_PPAPI_NACL(Graphics2D_Replace)
227 TEST_PPAPI_NACL(Graphics2D_Flush)
228 TEST_PPAPI_NACL(Graphics2D_FlushOffscreenUpdate)
229 TEST_PPAPI_NACL(Graphics2D_BindNull)
231 #if defined(OS_WIN)
232 #if defined(USE_AURA)
233 // These tests fail with the test compositor which is what's used by default for
234 // browser tests on Windows Aura. Renable when the software compositor is
235 // available.
236 #define MAYBE_IN_Graphics3D DISABLED_Graphics3D
237 #define MAYBE_OUT_Graphics3D DISABLED_Graphics3D
238 #define MAYBE_NACL_Graphics3D DISABLED_Graphics3D
239 #else // defined(USE_AURA)
240 // In-process and NaCl tests are having flaky failures on Win: crbug.com/242252
241 #define MAYBE_IN_Graphics3D DISABLED_Graphics3D
242 #define MAYBE_OUT_Graphics3D Graphics3D
243 #define MAYBE_NACL_Graphics3D DISABLED_Graphics3D
244 #endif // defined(USE_AURA)
245 #elif defined(OS_MACOSX)
246 // These tests fail when using the legacy software mode. Reenable when the
247 // software compositor is enabled crbug.com/286038
248 #define MAYBE_IN_Graphics3D DISABLED_Graphics3D
249 #define MAYBE_OUT_Graphics3D DISABLED_Graphics3D
250 #define MAYBE_NACL_Graphics3D DISABLED_Graphics3D
251 #else
252 // The tests are failing in-process. crbug.com/280282
253 #define MAYBE_IN_Graphics3D DISABLED_Graphics3D
254 #define MAYBE_OUT_Graphics3D Graphics3D
255 #define MAYBE_NACL_Graphics3D Graphics3D
256 #endif
257 TEST_PPAPI_OUT_OF_PROCESS(MAYBE_OUT_Graphics3D)
258 TEST_PPAPI_NACL(MAYBE_NACL_Graphics3D)
260 TEST_PPAPI_NACL(ImageData)
262 // TCPSocket and TCPSocketPrivate tests.
263 #define RUN_TCPSOCKET_SUBTESTS \
264 RunTestViaHTTP( \
265 LIST_TEST(TCPSocket_Connect) \
266 LIST_TEST(TCPSocket_ReadWrite) \
267 LIST_TEST(TCPSocket_SetOption) \
268 LIST_TEST(TCPSocket_Listen) \
269 LIST_TEST(TCPSocket_Backlog) \
270 LIST_TEST(TCPSocket_Interface_1_0) \
273 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, TCPSocket) {
274 RUN_TCPSOCKET_SUBTESTS;
276 #if defined(OS_MACOSX) && defined(ADDRESS_SANITIZER)
277 // Flaky on Mac ASAN: http://crbug.com/437408 and http://crbug.com/457501.
278 #define MAYBE_TCPSocket DISABLED_TCPSocket
279 #else
280 #define MAYBE_TCPSocket TCPSocket
281 #endif
282 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_TCPSocket) {
283 RUN_TCPSOCKET_SUBTESTS;
285 // Flaky on Mac ASAN: http://crbug.com/437408
286 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, MAYBE_TCPSocket) {
287 RUN_TCPSOCKET_SUBTESTS;
289 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
290 MAYBE_PNACL_NONSFI(TCPSocket)) {
291 RUN_TCPSOCKET_SUBTESTS;
293 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
294 MAYBE_PNACL_TRANSITIONAL_NONSFI(TCPSocket)) {
295 RUN_TCPSOCKET_SUBTESTS;
299 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(TCPServerSocketPrivate)
300 TEST_PPAPI_NACL(TCPServerSocketPrivate)
302 TEST_PPAPI_OUT_OF_PROCESS_WITH_SSL_SERVER(TCPSocketPrivate)
304 #if defined(OS_MACOSX) && defined(ADDRESS_SANITIZER)
305 // Flaky on Mac ASAN: http://crbug.com/437408.
306 #define MAYBE_TCPSocketPrivate DISABLED_TCPSocketPrivate
307 #else
308 #define MAYBE_TCPSocketPrivate TCPSocketPrivate
309 #endif
310 TEST_PPAPI_NACL_WITH_SSL_SERVER(MAYBE_TCPSocketPrivate)
312 TEST_PPAPI_OUT_OF_PROCESS_WITH_SSL_SERVER(TCPSocketPrivateTrusted)
314 // UDPSocket tests.
315 // UDPSocket_Broadcast is disabled for OSX because it requires root
316 // permissions on OSX 10.7+.
317 #if defined(OS_MACOSX)
318 #define MAYBE_UDPSocket_Broadcast DISABLED_UDPSocket_Broadcast
319 #else
320 #define MAYBE_UDPSocket_Broadcast UDPSocket_Broadcast
321 #endif
323 #define UDPSOCKET_TEST(_test) \
324 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, _test) { \
325 RunTestViaHTTP(LIST_TEST(_test)); \
327 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, _test) { \
328 RunTestViaHTTP(LIST_TEST(_test)); \
330 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(_test)) { \
331 RunTestViaHTTP(LIST_TEST(_test)); \
333 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, _test) { \
334 RunTestViaHTTP(LIST_TEST(_test)); \
336 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest, \
337 MAYBE_PNACL_NONSFI(_test)) { \
338 RunTestViaHTTP(LIST_TEST(_test)); \
340 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest, \
341 MAYBE_PNACL_TRANSITIONAL_NONSFI(_test)) { \
342 RunTestViaHTTP(LIST_TEST(_test)); \
345 // Instead of one single test for all UDPSocket features (like it is done for
346 // TCPSocket), split them into multiple, making it easier to isolate which tests
347 // are failing.
348 UDPSOCKET_TEST(UDPSocket_ReadWrite)
349 UDPSOCKET_TEST(UDPSocket_SetOption)
350 UDPSOCKET_TEST(UDPSocket_SetOption_1_0)
351 UDPSOCKET_TEST(UDPSocket_SetOption_1_1)
352 UDPSOCKET_TEST(MAYBE_UDPSocket_Broadcast)
353 UDPSOCKET_TEST(UDPSocket_ParallelSend)
354 UDPSOCKET_TEST(UDPSocket_Multicast)
356 // UDPSocketPrivate tests.
357 // UDPSocketPrivate_Broadcast is disabled for OSX because it requires root
358 // permissions on OSX 10.7+.
359 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(UDPSocketPrivate_Connect)
360 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(UDPSocketPrivate_ConnectFailure)
361 #if !defined(OS_MACOSX)
362 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(UDPSocketPrivate_Broadcast)
363 #endif // !defined(OS_MACOSX)
364 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(UDPSocketPrivate_SetSocketFeatureErrors)
365 TEST_PPAPI_NACL(UDPSocketPrivate_Connect)
366 TEST_PPAPI_NACL(UDPSocketPrivate_ConnectFailure)
367 #if !defined(OS_MACOSX)
368 TEST_PPAPI_NACL(UDPSocketPrivate_Broadcast)
369 #endif // !defined(OS_MACOSX)
370 TEST_PPAPI_NACL(UDPSocketPrivate_SetSocketFeatureErrors)
372 // Disallowed socket tests.
373 TEST_PPAPI_NACL_DISALLOWED_SOCKETS(HostResolverPrivateDisallowed)
374 TEST_PPAPI_NACL_DISALLOWED_SOCKETS(TCPServerSocketPrivateDisallowed)
375 TEST_PPAPI_NACL_DISALLOWED_SOCKETS(TCPSocketPrivateDisallowed)
376 TEST_PPAPI_NACL_DISALLOWED_SOCKETS(UDPSocketPrivateDisallowed)
378 // HostResolver and HostResolverPrivate tests.
379 #define RUN_HOST_RESOLVER_SUBTESTS \
380 RunTestViaHTTP( \
381 LIST_TEST(HostResolver_Empty) \
382 LIST_TEST(HostResolver_Resolve) \
383 LIST_TEST(HostResolver_ResolveIPv4) \
386 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, HostResolver) {
387 RUN_HOST_RESOLVER_SUBTESTS;
390 #if defined(OS_MACOSX) && defined(ADDRESS_SANITIZER)
391 // Flaky on Mac ASAN: http://crbug.com/437408
392 #define MAYBE_HostResolver DISABLED_HostResolver
393 #else
394 #define MAYBE_HostResolver HostResolver
395 #endif
396 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_HostResolver) {
397 RUN_HOST_RESOLVER_SUBTESTS;
399 // Flaky on Mac ASAN: http://crbug.com/437408
400 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, MAYBE_HostResolver) {
401 RUN_HOST_RESOLVER_SUBTESTS;
403 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
404 MAYBE_PNACL_NONSFI(HostResolver)) {
405 RUN_HOST_RESOLVER_SUBTESTS;
407 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
408 MAYBE_PNACL_TRANSITIONAL_NONSFI(HostResolver)) {
409 RUN_HOST_RESOLVER_SUBTESTS;
412 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(HostResolverPrivate_Resolve)
413 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(HostResolverPrivate_ResolveIPv4)
414 TEST_PPAPI_NACL(HostResolverPrivate_Resolve)
415 TEST_PPAPI_NACL(HostResolverPrivate_ResolveIPv4)
417 // URLLoader tests. These are split into multiple test fixtures because if we
418 // run them all together, they tend to time out.
419 #define RUN_URLLOADER_SUBTESTS_0 \
420 RunTestViaHTTP( \
421 LIST_TEST(URLLoader_BasicGET) \
422 LIST_TEST(URLLoader_BasicPOST) \
423 LIST_TEST(URLLoader_BasicFilePOST) \
424 LIST_TEST(URLLoader_BasicFileRangePOST) \
425 LIST_TEST(URLLoader_CompoundBodyPOST) \
428 #define RUN_URLLOADER_SUBTESTS_1 \
429 RunTestViaHTTP( \
430 LIST_TEST(URLLoader_EmptyDataPOST) \
431 LIST_TEST(URLLoader_BinaryDataPOST) \
432 LIST_TEST(URLLoader_CustomRequestHeader) \
433 LIST_TEST(URLLoader_FailsBogusContentLength) \
434 LIST_TEST(URLLoader_StreamToFile) \
437 // TODO(bbudge) Fix Javascript URLs for trusted loaders.
438 // http://crbug.com/103062
439 #define RUN_URLLOADER_SUBTESTS_2 \
440 RunTestViaHTTP( \
441 LIST_TEST(URLLoader_UntrustedSameOriginRestriction) \
442 LIST_TEST(URLLoader_UntrustedCrossOriginRequest) \
443 LIST_TEST(URLLoader_UntrustedJavascriptURLRestriction) \
444 LIST_TEST(DISABLED_URLLoader_TrustedJavascriptURLRestriction) \
447 #define RUN_URLLOADER_NACL_SUBTESTS_2 \
448 RunTestViaHTTP( \
449 LIST_TEST(URLLoader_UntrustedSameOriginRestriction) \
450 LIST_TEST(URLLoader_UntrustedCrossOriginRequest) \
451 LIST_TEST(URLLoader_UntrustedJavascriptURLRestriction) \
452 LIST_TEST(DISABLED_URLLoader_TrustedJavascriptURLRestriction) \
455 #define RUN_URLLOADER_SUBTESTS_3 \
456 RunTestViaHTTP( \
457 LIST_TEST(URLLoader_UntrustedHttpRequests) \
458 LIST_TEST(URLLoader_FollowURLRedirect) \
459 LIST_TEST(URLLoader_AuditURLRedirect) \
460 LIST_TEST(URLLoader_AbortCalls) \
461 LIST_TEST(URLLoader_UntendedLoad) \
462 LIST_TEST(URLLoader_PrefetchBufferThreshold) \
465 // Note: we do not support Trusted APIs in NaCl, so these will be skipped.
466 // XRequestedWithHeader isn't trusted per-se, but the header isn't provided
467 // for NaCl and thus must be skipped.
468 #define RUN_URLLOADER_TRUSTED_SUBTESTS \
469 RunTestViaHTTP( \
470 LIST_TEST(URLLoader_TrustedSameOriginRestriction) \
471 LIST_TEST(URLLoader_TrustedCrossOriginRequest) \
472 LIST_TEST(URLLoader_TrustedHttpRequests) \
473 LIST_TEST(URLLoader_XRequestedWithHeader) \
476 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, URLLoader0) {
477 RUN_URLLOADER_SUBTESTS_0;
479 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, URLLoader1) {
480 RUN_URLLOADER_SUBTESTS_1;
482 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, URLLoader2) {
483 RUN_URLLOADER_SUBTESTS_2;
485 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, URLLoader3) {
486 RUN_URLLOADER_SUBTESTS_3;
488 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, URLLoaderTrusted) {
489 RUN_URLLOADER_TRUSTED_SUBTESTS;
491 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, URLLoader0) {
492 RUN_URLLOADER_SUBTESTS_0;
494 #if defined(OS_MACOSX) && defined(ADDRESS_SANITIZER)
495 // Flaky on Mac ASAN: http://crbug.com/437411.
496 #define MAYBE_URLLoader1 DISABLED_URLLoader1
497 #else
498 #define MAYBE_URLLoader1 URLLoader1
499 #endif
500 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_URLLoader1) {
501 RUN_URLLOADER_SUBTESTS_1;
503 #if defined(OS_MACOSX) && defined(ADDRESS_SANITIZER)
504 // Flaky on Mac ASAN: http://crbug.com/437411.
505 #define MAYBE_URLLoader2 DISABLED_URLLoader2
506 #else
507 #define MAYBE_URLLoader2 URLLoader2
508 #endif
509 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_URLLoader2) {
510 RUN_URLLOADER_SUBTESTS_2;
512 #if defined(OS_MACOSX) && defined(ADDRESS_SANITIZER)
513 // Flaky on Mac ASAN: http://crbug.com/437411.
514 #define MAYBE_URLLoader3 DISABLED_URLLoader3
515 #else
516 #define MAYBE_URLLoader3 URLLoader3
517 #endif
518 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_URLLoader3) {
519 RUN_URLLOADER_SUBTESTS_3;
522 // Flaky on 32-bit linux bot; http://crbug.com/308906
523 #if defined(OS_LINUX) && defined(ARCH_CPU_X86)
524 #define MAYBE_URLLoader_BasicFilePOST DISABLED_URLLoader_BasicFilePOST
525 #else
526 #define MAYBE_URLLoader_BasicFilePOST URLLoader_BasicFilePOST
527 #endif
529 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, URLLoader0) {
530 RUN_URLLOADER_SUBTESTS_0;
532 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, URLLoader1) {
533 RUN_URLLOADER_SUBTESTS_1;
535 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, URLLoader2) {
536 RUN_URLLOADER_SUBTESTS_2;
538 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, URLLoader3) {
539 RUN_URLLOADER_SUBTESTS_3;
541 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
542 MAYBE_PNACL_NONSFI(URLLoader0)) {
543 RUN_URLLOADER_SUBTESTS_0;
545 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
546 MAYBE_PNACL_NONSFI(URLLoader1)) {
547 RUN_URLLOADER_SUBTESTS_1;
549 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
550 MAYBE_PNACL_NONSFI(URLLoader2)) {
551 RUN_URLLOADER_SUBTESTS_2;
553 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
554 MAYBE_PNACL_NONSFI(URLLoader3)) {
555 RUN_URLLOADER_SUBTESTS_3;
557 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
558 MAYBE_PNACL_TRANSITIONAL_NONSFI(URLLoader0)) {
559 RUN_URLLOADER_SUBTESTS_0;
561 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
562 MAYBE_PNACL_TRANSITIONAL_NONSFI(URLLoader1)) {
563 RUN_URLLOADER_SUBTESTS_1;
565 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
566 MAYBE_PNACL_TRANSITIONAL_NONSFI(URLLoader2)) {
567 RUN_URLLOADER_SUBTESTS_2;
569 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
570 MAYBE_PNACL_TRANSITIONAL_NONSFI(URLLoader3)) {
571 RUN_URLLOADER_SUBTESTS_3;
575 // URLRequestInfo tests.
576 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(URLRequest_CreateAndIsURLRequestInfo)
578 // Timing out on Windows. http://crbug.com/129571
579 #if defined(OS_WIN)
580 #define MAYBE_URLRequest_CreateAndIsURLRequestInfo \
581 DISABLED_URLRequest_CreateAndIsURLRequestInfo
582 #else
583 #define MAYBE_URLRequest_CreateAndIsURLRequestInfo \
584 URLRequest_CreateAndIsURLRequestInfo
585 #endif
586 TEST_PPAPI_NACL(MAYBE_URLRequest_CreateAndIsURLRequestInfo)
588 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(URLRequest_SetProperty)
589 TEST_PPAPI_NACL(URLRequest_SetProperty)
590 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(URLRequest_AppendDataToBody)
591 TEST_PPAPI_NACL(URLRequest_AppendDataToBody)
592 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(DISABLED_URLRequest_AppendFileToBody)
593 TEST_PPAPI_NACL(DISABLED_URLRequest_AppendFileToBody)
594 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(URLRequest_Stress)
595 TEST_PPAPI_NACL(URLRequest_Stress)
597 TEST_PPAPI_OUT_OF_PROCESS(PaintAggregator)
598 TEST_PPAPI_NACL(PaintAggregator)
600 // TODO(danakj): http://crbug.com/115286
601 TEST_PPAPI_NACL(DISABLED_Scrollbar)
603 TEST_PPAPI_NACL(Var)
605 TEST_PPAPI_NACL(VarResource)
607 // PostMessage tests.
608 #define RUN_POSTMESSAGE_SUBTESTS \
609 RunTestViaHTTP( \
610 LIST_TEST(PostMessage_SendInInit) \
611 LIST_TEST(PostMessage_SendingData) \
612 LIST_TEST(PostMessage_SendingString) \
613 LIST_TEST(PostMessage_SendingArrayBuffer) \
614 LIST_TEST(PostMessage_SendingArray) \
615 LIST_TEST(PostMessage_SendingDictionary) \
616 LIST_TEST(PostMessage_SendingResource) \
617 LIST_TEST(PostMessage_SendingComplexVar) \
618 LIST_TEST(PostMessage_MessageEvent) \
619 LIST_TEST(PostMessage_NoHandler) \
620 LIST_TEST(PostMessage_ExtraParam) \
621 LIST_TEST(PostMessage_NonMainThread) \
624 // Windows defines 'PostMessage', so we have to undef it.
625 #ifdef PostMessage
626 #undef PostMessage
627 #endif
629 #if defined(OS_WIN)
630 // http://crbug.com/95557
631 #define MAYBE_PostMessage DISABLED_PostMessage
632 #else
633 #define MAYBE_PostMessage PostMessage
634 #endif
635 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, MAYBE_PostMessage) {
636 RUN_POSTMESSAGE_SUBTESTS;
639 #if defined(OS_MACOSX) && defined(ADDRESS_SANITIZER)
640 // Flaky on Mac ASAN: http://crbug.com/437408
641 // Suffixed by a 2 to avoid macro redefinition with the above.
642 #define MAYBE_PostMessage2 DISABLED_PostMessage
643 #else
644 #define MAYBE_PostMessage2 PostMessage
645 #endif
646 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_PostMessage2) {
647 RUN_POSTMESSAGE_SUBTESTS;
649 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, PostMessage) {
650 RUN_POSTMESSAGE_SUBTESTS;
652 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
653 MAYBE_PNACL_NONSFI(PostMessage)) {
654 RUN_POSTMESSAGE_SUBTESTS;
656 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
657 MAYBE_PNACL_TRANSITIONAL_NONSFI(PostMessage)) {
658 RUN_POSTMESSAGE_SUBTESTS;
661 TEST_PPAPI_NACL(Memory)
663 // FileIO tests.
664 #define RUN_FILEIO_SUBTESTS \
665 RunTestViaHTTP( \
666 LIST_TEST(FileIO_Open) \
667 LIST_TEST(FileIO_OpenDirectory) \
668 LIST_TEST(FileIO_AbortCalls) \
669 LIST_TEST(FileIO_ParallelReads) \
670 LIST_TEST(FileIO_ParallelWrites) \
671 LIST_TEST(FileIO_NotAllowMixedReadWrite) \
672 LIST_TEST(FileIO_ReadWriteSetLength) \
673 LIST_TEST(FileIO_ReadToArrayWriteSetLength) \
674 LIST_TEST(FileIO_TouchQuery) \
677 #define RUN_FILEIO_PRIVATE_SUBTESTS \
678 RunTestViaHTTP( \
679 LIST_TEST(FileIO_RequestOSFileHandle) \
680 LIST_TEST(FileIO_RequestOSFileHandleWithOpenExclusive) \
681 LIST_TEST(FileIO_Mmap) \
684 IN_PROC_BROWSER_TEST_F(PPAPIPrivateTest, FileIO_Private) {
685 RUN_FILEIO_PRIVATE_SUBTESTS;
688 // See: crbug.com/421284
689 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, DISABLED_FileIO) {
690 RUN_FILEIO_SUBTESTS;
692 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPIPrivateTest, FileIO_Private) {
693 RUN_FILEIO_PRIVATE_SUBTESTS;
696 // http://crbug.com/313401
697 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, DISABLED_FileIO) {
698 RUN_FILEIO_SUBTESTS;
700 // http://crbug.com/313401
701 IN_PROC_BROWSER_TEST_F(PPAPIPrivateNaClNewlibTest,
702 DISABLED_NaCl_Newlib_FileIO_Private) {
703 RUN_FILEIO_PRIVATE_SUBTESTS;
706 // http://crbug.com/313205
707 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, DISABLED_FileIO) {
708 RUN_FILEIO_SUBTESTS;
710 IN_PROC_BROWSER_TEST_F(PPAPIPrivateNaClPNaClTest,
711 DISABLED_PNaCl_FileIO_Private) {
712 RUN_FILEIO_PRIVATE_SUBTESTS;
715 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest, MAYBE_PNACL_NONSFI(FileIO)) {
716 RUN_FILEIO_SUBTESTS;
718 IN_PROC_BROWSER_TEST_F(PPAPIPrivateNaClPNaClNonSfiTest,
719 MAYBE_PNACL_NONSFI(FILEIO_Private)) {
720 RUN_FILEIO_PRIVATE_SUBTESTS;
723 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
724 MAYBE_PNACL_TRANSITIONAL_NONSFI(FileIO)) {
725 RUN_FILEIO_SUBTESTS;
727 IN_PROC_BROWSER_TEST_F(PPAPIPrivateNaClPNaClTransitionalNonSfiTest,
728 MAYBE_PNACL_TRANSITIONAL_NONSFI(FILEIO_Private)) {
729 RUN_FILEIO_PRIVATE_SUBTESTS;
732 // FileRef tests.
733 #define RUN_FILEREF_SUBTESTS_1 \
734 RunTestViaHTTP( \
735 LIST_TEST(FileRef_Create) \
736 LIST_TEST(FileRef_GetFileSystemType) \
737 LIST_TEST(FileRef_GetName) \
738 LIST_TEST(FileRef_GetPath) \
739 LIST_TEST(FileRef_GetParent) \
740 LIST_TEST(FileRef_MakeDirectory) \
743 #define RUN_FILEREF_SUBTESTS_2 \
744 RunTestViaHTTP( \
745 LIST_TEST(FileRef_QueryAndTouchFile) \
746 LIST_TEST(FileRef_DeleteFileAndDirectory) \
747 LIST_TEST(FileRef_RenameFileAndDirectory) \
748 LIST_TEST(FileRef_Query) \
749 LIST_TEST(FileRef_FileNameEscaping) \
752 // Note, the FileRef tests are split into two, because all of them together
753 // sometimes take too long on windows: crbug.com/336999
754 // FileRef_ReadDirectoryEntries is flaky, so left out. See crbug.com/241646.
755 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, FileRef1) {
756 RUN_FILEREF_SUBTESTS_1;
758 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, FileRef2) {
759 RUN_FILEREF_SUBTESTS_2;
762 #if defined(OS_MACOSX) && defined(ADDRESS_SANITIZER)
763 // Flaky on Mac ASAN: http://crbug.com/437411.
764 #define MAYBE_FileRef1 DISABLED_FileRef1
765 #else
766 #define MAYBE_FileRef1 FileRef1
767 #endif
768 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_FileRef1) {
769 RUN_FILEREF_SUBTESTS_1;
771 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, FileRef2) {
772 RUN_FILEREF_SUBTESTS_2;
774 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, FileRef1) {
775 RUN_FILEREF_SUBTESTS_1;
777 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, FileRef2) {
778 RUN_FILEREF_SUBTESTS_2;
780 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
781 MAYBE_PNACL_NONSFI(FileRef1)) {
782 RUN_FILEREF_SUBTESTS_1;
784 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
785 MAYBE_PNACL_NONSFI(FileRef2)) {
786 RUN_FILEREF_SUBTESTS_2;
788 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
789 MAYBE_PNACL_TRANSITIONAL_NONSFI(FileRef1)) {
790 RUN_FILEREF_SUBTESTS_1;
792 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
793 MAYBE_PNACL_TRANSITIONAL_NONSFI(FileRef2)) {
794 RUN_FILEREF_SUBTESTS_2;
797 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(FileSystem)
799 // PPAPINaClTest.FileSystem times out consistently on Windows and Mac.
800 // http://crbug.com/130372
801 #if defined(OS_MACOSX) || defined(OS_WIN)
802 #define MAYBE_FileSystem DISABLED_FileSystem
803 #else
804 #define MAYBE_FileSystem FileSystem
805 #endif
807 TEST_PPAPI_NACL(MAYBE_FileSystem)
809 #if defined(OS_MACOSX)
810 // http://crbug.com/103912
811 #define MAYBE_Fullscreen DISABLED_Fullscreen
812 #elif defined(OS_LINUX)
813 // http://crbug.com/146008
814 #define MAYBE_Fullscreen DISABLED_Fullscreen
815 #elif defined(OS_WIN)
816 // http://crbug.com/342269
817 #define MAYBE_Fullscreen DISABLED_Fullscreen
818 #else
819 #define MAYBE_Fullscreen Fullscreen
820 #endif
822 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(MAYBE_Fullscreen)
823 TEST_PPAPI_NACL(MAYBE_Fullscreen)
825 TEST_PPAPI_OUT_OF_PROCESS(X509CertificatePrivate)
827 TEST_PPAPI_OUT_OF_PROCESS(UMA)
828 TEST_PPAPI_NACL(UMA)
830 // NetAddress tests.
831 #define RUN_NETADDRESS_SUBTESTS \
832 RunTestViaHTTP( \
833 LIST_TEST(NetAddress_IPv4Address) \
834 LIST_TEST(NetAddress_IPv6Address) \
835 LIST_TEST(NetAddress_DescribeAsString) \
838 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, NetAddress) {
839 RUN_NETADDRESS_SUBTESTS;
841 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, NetAddress) {
842 RUN_NETADDRESS_SUBTESTS;
844 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, NetAddress) {
845 RUN_NETADDRESS_SUBTESTS;
847 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
848 MAYBE_PNACL_NONSFI(NetAddress)) {
849 RUN_NETADDRESS_SUBTESTS;
851 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
852 MAYBE_PNACL_TRANSITIONAL_NONSFI(NetAddress)) {
853 RUN_NETADDRESS_SUBTESTS;
856 // NetAddressPrivate tests.
857 #define RUN_NETADDRESS_PRIVATE_SUBTESTS \
858 RunTestViaHTTP( \
859 LIST_TEST(NetAddressPrivate_AreEqual) \
860 LIST_TEST(NetAddressPrivate_AreHostsEqual) \
861 LIST_TEST(NetAddressPrivate_Describe) \
862 LIST_TEST(NetAddressPrivate_ReplacePort) \
863 LIST_TEST(NetAddressPrivate_GetAnyAddress) \
864 LIST_TEST(NetAddressPrivate_DescribeIPv6) \
865 LIST_TEST(NetAddressPrivate_GetFamily) \
866 LIST_TEST(NetAddressPrivate_GetPort) \
867 LIST_TEST(NetAddressPrivate_GetAddress) \
868 LIST_TEST(NetAddressPrivate_GetScopeID) \
871 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, NetAddressPrivate) {
872 RUN_NETADDRESS_PRIVATE_SUBTESTS;
875 #define RUN_NETADDRESS_PRIVATE_UNTRUSTED_SUBTESTS \
876 RunTestViaHTTP( \
877 LIST_TEST(NetAddressPrivateUntrusted_AreEqual) \
878 LIST_TEST(NetAddressPrivateUntrusted_AreHostsEqual) \
879 LIST_TEST(NetAddressPrivateUntrusted_Describe) \
880 LIST_TEST(NetAddressPrivateUntrusted_ReplacePort) \
881 LIST_TEST(NetAddressPrivateUntrusted_GetAnyAddress) \
882 LIST_TEST(NetAddressPrivateUntrusted_GetFamily) \
883 LIST_TEST(NetAddressPrivateUntrusted_GetPort) \
884 LIST_TEST(NetAddressPrivateUntrusted_GetAddress) \
887 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, NetAddressPrivate) {
888 RUN_NETADDRESS_PRIVATE_UNTRUSTED_SUBTESTS;
890 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, NetAddressPrivate) {
891 RUN_NETADDRESS_PRIVATE_UNTRUSTED_SUBTESTS;
893 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
894 MAYBE_PNACL_NONSFI(NetAddressPrivate)) {
895 RUN_NETADDRESS_PRIVATE_UNTRUSTED_SUBTESTS;
897 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
898 MAYBE_PNACL_TRANSITIONAL_NONSFI(NetAddressPrivate)) {
899 RUN_NETADDRESS_PRIVATE_UNTRUSTED_SUBTESTS;
902 // NetworkMonitor tests.
903 #define RUN_NETWORK_MONITOR_SUBTESTS \
904 RunTestViaHTTP( \
905 LIST_TEST(NetworkMonitor_Basic) \
906 LIST_TEST(NetworkMonitor_2Monitors) \
907 LIST_TEST(NetworkMonitor_DeleteInCallback) \
910 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, NetworkMonitor) {
911 RUN_NETWORK_MONITOR_SUBTESTS;
913 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, NetworkMonitor) {
914 RUN_NETWORK_MONITOR_SUBTESTS;
916 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, NetworkMonitor) {
917 RUN_NETWORK_MONITOR_SUBTESTS;
919 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
920 MAYBE_PNACL_NONSFI(NetworkMonitor)) {
921 RUN_NETWORK_MONITOR_SUBTESTS;
923 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
924 MAYBE_PNACL_TRANSITIONAL_NONSFI(NetworkMonitor)) {
925 RUN_NETWORK_MONITOR_SUBTESTS;
928 // Flash tests.
929 #define RUN_FLASH_SUBTESTS \
930 RunTestViaHTTP( \
931 LIST_TEST(Flash_SetInstanceAlwaysOnTop) \
932 LIST_TEST(Flash_GetCommandLineArgs) \
935 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, Flash) {
936 RUN_FLASH_SUBTESTS;
939 // In-process WebSocket tests. Note, the WebSocket tests are split into two,
940 // because all of them together sometimes take too long on windows:
941 // crbug.com/336999
942 #define RUN_WEBSOCKET_SUBTESTS_1 \
943 RunTestWithWebSocketServer( \
944 LIST_TEST(WebSocket_IsWebSocket) \
945 LIST_TEST(WebSocket_UninitializedPropertiesAccess) \
946 LIST_TEST(WebSocket_InvalidConnect) \
947 LIST_TEST(WebSocket_Protocols) \
948 LIST_TEST(WebSocket_GetURL) \
949 LIST_TEST(WebSocket_ValidConnect) \
950 LIST_TEST(WebSocket_InvalidClose) \
951 LIST_TEST(WebSocket_ValidClose) \
952 LIST_TEST(WebSocket_GetProtocol) \
953 LIST_TEST(WebSocket_TextSendReceive) \
954 LIST_TEST(WebSocket_BinarySendReceive) \
955 LIST_TEST(WebSocket_StressedSendReceive) \
956 LIST_TEST(WebSocket_BufferedAmount) \
959 #define RUN_WEBSOCKET_SUBTESTS_2 \
960 RunTestWithWebSocketServer( \
961 LIST_TEST(WebSocket_AbortCallsWithCallback) \
962 LIST_TEST(WebSocket_AbortSendMessageCall) \
963 LIST_TEST(WebSocket_AbortCloseCall) \
964 LIST_TEST(WebSocket_AbortReceiveMessageCall) \
965 LIST_TEST(WebSocket_ClosedFromServerWhileSending) \
966 LIST_TEST(WebSocket_CcInterfaces) \
967 LIST_TEST(WebSocket_UtilityInvalidConnect) \
968 LIST_TEST(WebSocket_UtilityProtocols) \
969 LIST_TEST(WebSocket_UtilityGetURL) \
970 LIST_TEST(WebSocket_UtilityValidConnect) \
971 LIST_TEST(WebSocket_UtilityInvalidClose) \
972 LIST_TEST(WebSocket_UtilityValidClose) \
973 LIST_TEST(WebSocket_UtilityGetProtocol) \
974 LIST_TEST(WebSocket_UtilityTextSendReceive) \
975 LIST_TEST(WebSocket_UtilityBinarySendReceive) \
976 LIST_TEST(WebSocket_UtilityBufferedAmount) \
979 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, WebSocket1) {
980 RUN_WEBSOCKET_SUBTESTS_1;
982 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, WebSocket2) {
983 RUN_WEBSOCKET_SUBTESTS_2;
985 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, WebSocket1) {
986 RUN_WEBSOCKET_SUBTESTS_1;
988 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, WebSocket2) {
989 RUN_WEBSOCKET_SUBTESTS_2;
991 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, WebSocket1) {
992 RUN_WEBSOCKET_SUBTESTS_1;
994 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, WebSocket2) {
995 RUN_WEBSOCKET_SUBTESTS_2;
997 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
998 MAYBE_PNACL_NONSFI(WebSocket1)) {
999 RUN_WEBSOCKET_SUBTESTS_1;
1001 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
1002 MAYBE_PNACL_NONSFI(WebSocket2)) {
1003 RUN_WEBSOCKET_SUBTESTS_2;
1005 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
1006 MAYBE_PNACL_TRANSITIONAL_NONSFI(WebSocket1)) {
1007 RUN_WEBSOCKET_SUBTESTS_1;
1009 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
1010 MAYBE_PNACL_TRANSITIONAL_NONSFI(WebSocket2)) {
1011 RUN_WEBSOCKET_SUBTESTS_2;
1014 // AudioConfig tests
1015 #define RUN_AUDIO_CONFIG_SUBTESTS \
1016 RunTestViaHTTP( \
1017 LIST_TEST(AudioConfig_RecommendSampleRate) \
1018 LIST_TEST(AudioConfig_ValidConfigs) \
1019 LIST_TEST(AudioConfig_InvalidConfigs) \
1022 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, AudioConfig) {
1023 RUN_AUDIO_CONFIG_SUBTESTS;
1025 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, AudioConfig) {
1026 RUN_AUDIO_CONFIG_SUBTESTS;
1028 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(AudioConfig)) {
1029 RUN_AUDIO_CONFIG_SUBTESTS;
1031 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, AudioConfig) {
1032 RUN_AUDIO_CONFIG_SUBTESTS;
1034 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
1035 MAYBE_PNACL_NONSFI(AudioConfig)) {
1036 RUN_AUDIO_CONFIG_SUBTESTS;
1038 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
1039 MAYBE_PNACL_TRANSITIONAL_NONSFI(AudioConfig)) {
1040 RUN_AUDIO_CONFIG_SUBTESTS;
1043 // PPB_Audio tests.
1044 #define RUN_AUDIO_SUBTESTS \
1045 RunTestViaHTTP( \
1046 LIST_TEST(Audio_Creation) \
1047 LIST_TEST(Audio_DestroyNoStop) \
1048 LIST_TEST(Audio_Failures) \
1049 LIST_TEST(Audio_AudioCallback1) \
1050 LIST_TEST(Audio_AudioCallback2) \
1051 LIST_TEST(Audio_AudioCallback3) \
1052 LIST_TEST(Audio_AudioCallback4) \
1055 #if defined(OS_LINUX)
1056 // http://crbug.com/396464
1057 #define MAYBE_Audio DISABLED_Audio
1058 #else
1059 #define MAYBE_Audio Audio
1060 #endif
1061 // PPB_Audio is not supported in-process.
1062 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, MAYBE_Audio) {
1063 RUN_AUDIO_SUBTESTS;
1065 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, Audio) {
1066 RUN_AUDIO_SUBTESTS;
1068 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(Audio)) {
1069 RUN_AUDIO_SUBTESTS;
1071 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, Audio) {
1072 RUN_AUDIO_SUBTESTS;
1074 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
1075 MAYBE_PNACL_NONSFI(Audio)) {
1076 RUN_AUDIO_SUBTESTS;
1078 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
1079 MAYBE_PNACL_TRANSITIONAL_NONSFI(Audio)) {
1080 RUN_AUDIO_SUBTESTS;
1083 #define RUN_AUDIO_THREAD_CREATOR_SUBTESTS \
1084 RunTestViaHTTP( \
1085 LIST_TEST(Audio_AudioThreadCreatorIsRequired) \
1086 LIST_TEST(Audio_AudioThreadCreatorIsCalled) \
1089 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, AudioThreadCreator) {
1090 RUN_AUDIO_THREAD_CREATOR_SUBTESTS;
1092 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(AudioThreadCreator)) {
1093 RUN_AUDIO_THREAD_CREATOR_SUBTESTS;
1095 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, AudioThreadCreator) {
1096 RUN_AUDIO_THREAD_CREATOR_SUBTESTS;
1098 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
1099 MAYBE_PNACL_NONSFI(AudioThreadCreator)) {
1100 RUN_AUDIO_THREAD_CREATOR_SUBTESTS;
1102 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
1103 MAYBE_PNACL_TRANSITIONAL_NONSFI(AudioThreadCreator)) {
1104 RUN_AUDIO_THREAD_CREATOR_SUBTESTS;
1107 TEST_PPAPI_OUT_OF_PROCESS(View_CreatedVisible);
1108 TEST_PPAPI_NACL(View_CreatedVisible);
1109 // This test ensures that plugins created in a background tab have their
1110 // initial visibility set to false. We don't bother testing in-process for this
1111 // custom test since the out of process code also exercises in-process.
1113 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, View_CreateInvisible) {
1114 // Make a second tab in the foreground.
1115 GURL url = GetTestFileUrl("View_CreatedInvisible");
1116 chrome::NavigateParams params(browser(), url, ui::PAGE_TRANSITION_LINK);
1117 params.disposition = NEW_BACKGROUND_TAB;
1118 ui_test_utils::NavigateToURL(&params);
1121 // This test messes with tab visibility so is custom.
1122 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, DISABLED_View_PageHideShow) {
1123 // The plugin will be loaded in the foreground tab and will send us a message.
1124 PPAPITestMessageHandler handler;
1125 content::JavascriptTestObserver observer(
1126 browser()->tab_strip_model()->GetActiveWebContents(),
1127 &handler);
1129 GURL url = GetTestFileUrl("View_PageHideShow");
1130 ui_test_utils::NavigateToURL(browser(), url);
1132 ASSERT_TRUE(observer.Run()) << handler.error_message();
1133 EXPECT_STREQ("TestPageHideShow:Created", handler.message().c_str());
1134 observer.Reset();
1136 // Make a new tab to cause the original one to hide, this should trigger the
1137 // next phase of the test.
1138 chrome::NavigateParams params(
1139 browser(), GURL(url::kAboutBlankURL), ui::PAGE_TRANSITION_LINK);
1140 params.disposition = NEW_FOREGROUND_TAB;
1141 ui_test_utils::NavigateToURL(&params);
1143 // Wait until the test acks that it got hidden.
1144 ASSERT_TRUE(observer.Run()) << handler.error_message();
1145 EXPECT_STREQ("TestPageHideShow:Hidden", handler.message().c_str());
1146 observer.Reset();
1148 // Switch back to the test tab.
1149 browser()->tab_strip_model()->ActivateTabAt(0, true);
1151 ASSERT_TRUE(observer.Run()) << handler.error_message();
1152 EXPECT_STREQ("PASS", handler.message().c_str());
1155 // Tests that if a plugin accepts touch events, the browser knows to send touch
1156 // events to the renderer.
1157 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, InputEvent_AcceptTouchEvent) {
1158 std::string positive_tests[] = { "InputEvent_AcceptTouchEvent_1",
1159 "InputEvent_AcceptTouchEvent_2",
1160 "InputEvent_AcceptTouchEvent_3",
1161 "InputEvent_AcceptTouchEvent_4"
1164 for (size_t i = 0; i < arraysize(positive_tests); ++i) {
1165 RenderViewHost* host = browser()->tab_strip_model()->
1166 GetActiveWebContents()->GetRenderViewHost();
1167 RunTest(positive_tests[i]);
1168 EXPECT_TRUE(content::RenderViewHostTester::HasTouchEventHandler(host));
1172 // View tests.
1173 #define RUN_VIEW_SUBTESTS \
1174 RunTestViaHTTP( \
1175 LIST_TEST(View_SizeChange) \
1176 LIST_TEST(View_ClipChange) \
1177 LIST_TEST(View_ScrollOffsetChange) \
1180 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, View) {
1181 RUN_VIEW_SUBTESTS;
1183 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, View) {
1184 RUN_VIEW_SUBTESTS;
1186 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, View) {
1187 RUN_VIEW_SUBTESTS;
1189 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest, MAYBE_PNACL_NONSFI(View)) {
1190 RUN_VIEW_SUBTESTS;
1192 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
1193 MAYBE_PNACL_TRANSITIONAL_NONSFI(View)) {
1194 RUN_VIEW_SUBTESTS;
1197 // FlashMessageLoop tests.
1198 #define RUN_FLASH_MESSAGE_LOOP_SUBTESTS \
1199 RunTest( \
1200 LIST_TEST(FlashMessageLoop_Basics) \
1201 LIST_TEST(FlashMessageLoop_RunWithoutQuit) \
1204 #if defined(OS_LINUX) // Disabled due to flakiness http://crbug.com/316925
1205 #define MAYBE_FlashMessageLoop DISABLED_FlashMessageLoop
1206 #else
1207 #define MAYBE_FlashMessageLoop FlashMessageLoop
1208 #endif
1209 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, MAYBE_FlashMessageLoop) {
1210 RUN_FLASH_MESSAGE_LOOP_SUBTESTS;
1213 // The compositor test timeouts sometimes, so we have to split it to two
1214 // subtests.
1215 #define RUN_COMPOSITOR_SUBTESTS_0 \
1216 RunTestViaHTTP( \
1217 LIST_TEST(Compositor_BindUnbind) \
1218 LIST_TEST(Compositor_Release) \
1219 LIST_TEST(Compositor_ReleaseUnbound) \
1220 LIST_TEST(Compositor_ReleaseWithoutCommit) \
1221 LIST_TEST(Compositor_ReleaseWithoutCommitUnbound) \
1224 #define RUN_COMPOSITOR_SUBTESTS_1 \
1225 RunTestViaHTTP( \
1226 LIST_TEST(Compositor_CommitTwoTimesWithoutChange) \
1227 LIST_TEST(Compositor_CommitTwoTimesWithoutChangeUnbound) \
1228 LIST_TEST(Compositor_General) \
1229 LIST_TEST(Compositor_GeneralUnbound) \
1232 #if defined(OS_WIN)
1233 // This test fails with the test compositor which is what's used by default for
1234 // browser tests on Windows. Renable when the software compositor is available.
1235 #define MAYBE_Compositor0 DISABLED_Compositor0
1236 #define MAYBE_Compositor1 DISABLED_Compositor1
1237 #elif defined(OS_MACOSX)
1238 // This test fails when using the legacy software mode. Reenable when the
1239 // software compositor is enabled crbug.com/286038
1240 #define MAYBE_Compositor0 DISABLED_Compositor0
1241 #define MAYBE_Compositor1 DISABLED_Compositor1
1242 #else
1243 // flaky on Linux: http://crbug.com/396482
1244 #define MAYBE_Compositor0 DISABLED_Compositor0
1245 #define MAYBE_Compositor1 DISABLED_Compositor1
1246 #endif
1248 TEST_PPAPI_NACL_SUBTESTS(MAYBE_Compositor0, RUN_COMPOSITOR_SUBTESTS_0)
1249 TEST_PPAPI_NACL_SUBTESTS(MAYBE_Compositor1, RUN_COMPOSITOR_SUBTESTS_1)
1251 #if defined(OS_LINUX) || defined(OS_WIN) || defined(OS_CHROMEOS)
1252 // Flaky on ChromeOS, Linux and Windows (crbug.com/438729)
1253 #define MAYBE_MediaStreamAudioTrack DISABLED_MediaStreamAudioTrack
1254 #else
1255 #define MAYBE_MediaStreamAudioTrack MediaStreamAudioTrack
1256 #endif
1257 TEST_PPAPI_NACL(MAYBE_MediaStreamAudioTrack)
1259 TEST_PPAPI_NACL(MediaStreamVideoTrack)
1261 TEST_PPAPI_NACL(MouseCursor)
1263 TEST_PPAPI_NACL(NetworkProxy)
1265 TEST_PPAPI_NACL(TrueTypeFont)
1267 TEST_PPAPI_NACL(VideoDecoder)
1269 TEST_PPAPI_NACL(VideoEncoder)
1271 // VideoDestination doesn't work in content_browsertests.
1272 TEST_PPAPI_OUT_OF_PROCESS(VideoDestination)
1273 TEST_PPAPI_NACL(VideoDestination)
1275 // VideoSource doesn't work in content_browsertests.
1276 TEST_PPAPI_OUT_OF_PROCESS(VideoSource)
1277 TEST_PPAPI_NACL(VideoSource)
1279 // Printing doesn't work in content_browsertests.
1280 TEST_PPAPI_OUT_OF_PROCESS(Printing)
1282 TEST_PPAPI_NACL(MessageHandler)
1284 TEST_PPAPI_NACL(MessageLoop_Basics)
1285 TEST_PPAPI_NACL(MessageLoop_Post)
1287 // Going forward, Flash APIs will only work out-of-process.
1288 TEST_PPAPI_OUT_OF_PROCESS(Flash_GetLocalTimeZoneOffset)
1289 TEST_PPAPI_OUT_OF_PROCESS(Flash_GetProxyForURL)
1290 TEST_PPAPI_OUT_OF_PROCESS(Flash_GetSetting)
1291 TEST_PPAPI_OUT_OF_PROCESS(Flash_SetCrashData)
1292 // http://crbug.com/176822
1293 #if !defined(OS_WIN)
1294 TEST_PPAPI_OUT_OF_PROCESS(FlashClipboard)
1295 #endif
1296 TEST_PPAPI_OUT_OF_PROCESS(FlashFile)
1297 // Mac/Aura reach NOTIMPLEMENTED/time out.
1298 // mac: http://crbug.com/96767
1299 // aura: http://crbug.com/104384
1300 // cros: http://crbug.com/396502
1301 #if defined(OS_MACOSX) || defined(OS_CHROMEOS)
1302 #define MAYBE_FlashFullscreen DISABLED_FlashFullscreen
1303 #else
1304 #define MAYBE_FlashFullscreen FlashFullscreen
1305 #endif
1306 TEST_PPAPI_OUT_OF_PROCESS(MAYBE_FlashFullscreen)
1308 TEST_PPAPI_OUT_OF_PROCESS(PDF)
1310 // TODO(dalecurtis): Renable once the platform verification infobar has been
1311 // implemented; see http://crbug.com/270908
1312 // #if defined(OS_CHROMEOS)
1313 // TEST_PPAPI_OUT_OF_PROCESS(PlatformVerificationPrivate)
1314 // #endif
1316 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, FlashDRM) {
1317 RunTest(
1318 #if (defined(OS_WIN) && defined(ENABLE_RLZ)) || defined(OS_CHROMEOS)
1319 // Only implemented on Windows and ChromeOS currently.
1320 LIST_TEST(FlashDRM_GetDeviceID)
1321 #endif
1322 LIST_TEST(FlashDRM_GetHmonitor)
1323 LIST_TEST(FlashDRM_GetVoucherFile));
1326 #if defined(OS_CHROMEOS)
1327 TEST_PPAPI_OUT_OF_PROCESS(OutputProtectionPrivate)
1328 #endif
1330 #if !defined(DISABLE_NACL)
1331 class PackagedAppTest : public ExtensionBrowserTest {
1332 public:
1333 explicit PackagedAppTest(const std::string& toolchain)
1334 : toolchain_(toolchain) { }
1336 void LaunchTestingApp(const std::string& extension_dirname) {
1337 base::FilePath data_dir;
1338 ASSERT_TRUE(PathService::Get(chrome::DIR_GEN_TEST_DATA, &data_dir));
1339 base::FilePath app_dir = data_dir.AppendASCII("ppapi")
1340 .AppendASCII("tests")
1341 .AppendASCII("extensions")
1342 .AppendASCII(extension_dirname)
1343 .AppendASCII(toolchain_);
1345 const extensions::Extension* extension = LoadExtension(app_dir);
1346 ASSERT_TRUE(extension);
1348 AppLaunchParams params(browser()->profile(), extension,
1349 extensions::LAUNCH_CONTAINER_NONE, NEW_WINDOW,
1350 extensions::SOURCE_TEST);
1351 params.command_line = *base::CommandLine::ForCurrentProcess();
1352 OpenApplication(params);
1355 void RunTests(const std::string& extension_dirname) {
1356 ExtensionTestMessageListener listener("PASS", true);
1357 LaunchTestingApp(extension_dirname);
1358 EXPECT_TRUE(listener.WaitUntilSatisfied());
1360 protected:
1361 std::string toolchain_;
1364 class NewlibPackagedAppTest : public PackagedAppTest {
1365 public:
1366 NewlibPackagedAppTest() : PackagedAppTest("newlib") { }
1369 class NonSfiPackagedAppTest : public PackagedAppTest {
1370 public:
1371 NonSfiPackagedAppTest() : PackagedAppTest("nonsfi") { }
1373 void SetUpCommandLine(base::CommandLine* command_line) override {
1374 PackagedAppTest::SetUpCommandLine(command_line);
1375 command_line->AppendSwitch(switches::kEnableNaClNonSfiMode);
1379 // TODO(hidehiko): Switch for NonSfi tests to use nacl_helper_nonsfi, when
1380 // it is launched officially. See NaClBrowserTestPnaclTransitionalNonSfi
1381 // for more details.
1382 class TransitionalNonSfiPackagedAppTest : public NonSfiPackagedAppTest {
1383 public:
1384 void SetUpCommandLine(base::CommandLine* command_line) override {
1385 NonSfiPackagedAppTest::SetUpCommandLine(command_line);
1386 command_line->AppendSwitch(switches::kUseNaClHelperNonSfi);
1390 // Load a packaged app, and wait for it to successfully post a "hello" message
1391 // back.
1392 IN_PROC_BROWSER_TEST_F(NewlibPackagedAppTest, SuccessfulLoad) {
1393 RunTests("packaged_app");
1396 IN_PROC_BROWSER_TEST_F(NonSfiPackagedAppTest,
1397 MAYBE_PNACL_NONSFI(SuccessfulLoad)) {
1398 RunTests("packaged_app");
1401 IN_PROC_BROWSER_TEST_F(TransitionalNonSfiPackagedAppTest,
1402 MAYBE_PNACL_TRANSITIONAL_NONSFI(SuccessfulLoad)) {
1403 RunTests("packaged_app");
1406 IN_PROC_BROWSER_TEST_F(NewlibPackagedAppTest, SocketPermissions) {
1407 RunTests("socket_permissions");
1410 #endif