Merge html-office-public repo into src
[chromium-blink-merge.git] / chrome / test / ppapi / ppapi_browsertest.cc
blobcc03f05875c0d857ed29d5b61d231d4b15375902
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/url_constants.h"
23 #include "content/public/test/javascript_test_observer.h"
24 #include "content/public/test/test_renderer_host.h"
25 #include "extensions/common/constants.h"
26 #include "extensions/test/extension_test_message_listener.h"
27 #include "ppapi/shared_impl/test_harness_utils.h"
29 using content::RenderViewHost;
31 // This macro finesses macro expansion to do what we want.
32 #define STRIP_PREFIXES(test_name) ppapi::StripTestPrefixes(#test_name)
33 // Turn the given token into a string. This allows us to use precompiler stuff
34 // to turn names into DISABLED_Foo, but still pass a string to RunTest.
35 #define STRINGIFY(test_name) #test_name
36 #define LIST_TEST(test_name) STRINGIFY(test_name) ","
38 // Use these macros to run the tests for a specific interface.
39 // Most interfaces should be tested with both macros.
40 #define TEST_PPAPI_IN_PROCESS(test_name) \
41 IN_PROC_BROWSER_TEST_F(PPAPITest, test_name) { \
42 RunTest(STRIP_PREFIXES(test_name)); \
44 #define TEST_PPAPI_OUT_OF_PROCESS(test_name) \
45 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, test_name) { \
46 RunTest(STRIP_PREFIXES(test_name)); \
49 // Similar macros that test over HTTP.
50 #define TEST_PPAPI_IN_PROCESS_VIA_HTTP(test_name) \
51 IN_PROC_BROWSER_TEST_F(PPAPITest, test_name) { \
52 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
54 #define TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(test_name) \
55 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, test_name) { \
56 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
59 // Similar macros that test with an SSL server.
60 #define TEST_PPAPI_IN_PROCESS_WITH_SSL_SERVER(test_name) \
61 IN_PROC_BROWSER_TEST_F(PPAPITest, test_name) { \
62 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \
64 #define TEST_PPAPI_OUT_OF_PROCESS_WITH_SSL_SERVER(test_name) \
65 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, test_name) { \
66 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \
69 #if defined(DISABLE_NACL)
71 #define TEST_PPAPI_NACL(test_name)
72 #define TEST_PPAPI_NACL_DISALLOWED_SOCKETS(test_name)
73 #define TEST_PPAPI_NACL_WITH_SSL_SERVER(test_name)
74 #define TEST_PPAPI_NACL_SUBTESTS(test_name, run_statement)
76 #else
78 // NaCl based PPAPI tests
79 #define TEST_PPAPI_NACL(test_name) \
80 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, test_name) { \
81 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
82 } \
83 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(test_name)) { \
84 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
85 } \
86 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, test_name) { \
87 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
88 } \
89 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest, \
90 MAYBE_PNACL_NONSFI(test_name)) { \
91 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
92 } \
93 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest, \
94 MAYBE_PNACL_TRANSITIONAL_NONSFI(test_name)) { \
95 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
98 // NaCl based PPAPI tests
99 #define TEST_PPAPI_NACL_SUBTESTS(test_name, run_statement) \
100 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, test_name) { \
101 run_statement; \
103 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(test_name)) { \
104 run_statement; \
106 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, test_name) { \
107 run_statement; \
109 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest, \
110 MAYBE_PNACL_NONSFI(test_name)) { \
111 run_statement; \
113 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest, \
114 MAYBE_PNACL_TRANSITIONAL_NONSFI(test_name)) { \
115 run_statement; \
118 // NaCl based PPAPI tests with disallowed socket API
119 #define TEST_PPAPI_NACL_DISALLOWED_SOCKETS(test_name) \
120 IN_PROC_BROWSER_TEST_F(PPAPINaClTestDisallowedSockets, test_name) { \
121 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
124 // NaCl based PPAPI tests with SSL server
125 #define TEST_PPAPI_NACL_WITH_SSL_SERVER(test_name) \
126 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, test_name) { \
127 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \
129 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(test_name)) { \
130 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \
132 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, test_name) { \
133 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \
135 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest, \
136 MAYBE_PNACL_NONSFI(test_name)) { \
137 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \
139 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest, \
140 MAYBE_PNACL_TRANSITIONAL_NONSFI(test_name)) { \
141 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \
145 #endif // DISABLE_NACL
148 // Interface tests.
151 TEST_PPAPI_IN_PROCESS(Broker)
152 // Flaky, http://crbug.com/111355
153 TEST_PPAPI_OUT_OF_PROCESS(DISABLED_Broker)
155 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Accept) {
156 // Accepting the infobar should grant permission to access the PPAPI broker.
157 InfoBarObserver observer(this);
158 observer.ExpectInfoBarAndAccept(true);
160 // PPB_Broker_Trusted::IsAllowed should return false before the infobar is
161 // popped and true after the infobar is popped.
162 RunTest("Broker_IsAllowedPermissionDenied");
163 RunTest("Broker_ConnectPermissionGranted");
164 RunTest("Broker_IsAllowedPermissionGranted");
166 // It should also set a content settings exception for the site.
167 GURL url = GetTestFileUrl("Broker_ConnectPermissionGranted");
168 HostContentSettingsMap* content_settings =
169 browser()->profile()->GetHostContentSettingsMap();
170 EXPECT_EQ(CONTENT_SETTING_ALLOW,
171 content_settings->GetContentSetting(
172 url, url, CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string()));
175 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Deny) {
176 // Canceling the infobar should deny permission to access the PPAPI broker.
177 InfoBarObserver observer(this);
178 observer.ExpectInfoBarAndAccept(false);
180 // PPB_Broker_Trusted::IsAllowed should return false before and after the
181 // infobar is popped.
182 RunTest("Broker_IsAllowedPermissionDenied");
183 RunTest("Broker_ConnectPermissionDenied");
184 RunTest("Broker_IsAllowedPermissionDenied");
186 // It should also set a content settings exception for the site.
187 GURL url = GetTestFileUrl("Broker_ConnectPermissionDenied");
188 HostContentSettingsMap* content_settings =
189 browser()->profile()->GetHostContentSettingsMap();
190 EXPECT_EQ(CONTENT_SETTING_BLOCK,
191 content_settings->GetContentSetting(
192 url, url, CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string()));
195 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Blocked) {
196 // Block access to the PPAPI broker.
197 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
198 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, CONTENT_SETTING_BLOCK);
200 // We shouldn't see an infobar.
201 InfoBarObserver observer(this);
203 RunTest("Broker_ConnectPermissionDenied");
204 RunTest("Broker_IsAllowedPermissionDenied");
207 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Allowed) {
208 // Always allow access to the PPAPI broker.
209 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
210 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, CONTENT_SETTING_ALLOW);
212 // We shouldn't see an infobar.
213 InfoBarObserver observer(this);
215 RunTest("Broker_ConnectPermissionGranted");
216 RunTest("Broker_IsAllowedPermissionGranted");
219 TEST_PPAPI_NACL(Console)
221 TEST_PPAPI_NACL(Core)
223 // Non-NaCl TraceEvent tests are in content/test/ppapi/ppapi_browsertest.cc.
224 TEST_PPAPI_NACL(TraceEvent)
226 TEST_PPAPI_NACL(InputEvent)
228 // Flaky on Linux and Windows. http://crbug.com/135403
229 #if defined(OS_LINUX) || defined(OS_WIN)
230 #define MAYBE_ImeInputEvent DISABLED_ImeInputEvent
231 #else
232 #define MAYBE_ImeInputEvent ImeInputEvent
233 #endif
235 TEST_PPAPI_OUT_OF_PROCESS(MAYBE_ImeInputEvent)
236 TEST_PPAPI_NACL(MAYBE_ImeInputEvent)
238 // Graphics2D_Dev isn't supported in NaCl, only test the other interfaces
239 // TODO(jhorwich) Enable when Graphics2D_Dev interfaces are proxied in NaCl.
240 TEST_PPAPI_NACL(Graphics2D_InvalidResource)
241 TEST_PPAPI_NACL(Graphics2D_InvalidSize)
242 TEST_PPAPI_NACL(Graphics2D_Humongous)
243 TEST_PPAPI_NACL(Graphics2D_InitToZero)
244 TEST_PPAPI_NACL(Graphics2D_Describe)
245 TEST_PPAPI_NACL(Graphics2D_Paint)
246 TEST_PPAPI_NACL(Graphics2D_Scroll)
247 TEST_PPAPI_NACL(Graphics2D_Replace)
248 TEST_PPAPI_NACL(Graphics2D_Flush)
249 TEST_PPAPI_NACL(Graphics2D_FlushOffscreenUpdate)
250 TEST_PPAPI_NACL(Graphics2D_BindNull)
252 #if defined(OS_WIN)
253 #if defined(USE_AURA)
254 // These tests fail with the test compositor which is what's used by default for
255 // browser tests on Windows Aura. Renable when the software compositor is
256 // available.
257 #define MAYBE_IN_Graphics3D DISABLED_Graphics3D
258 #define MAYBE_OUT_Graphics3D DISABLED_Graphics3D
259 #define MAYBE_NACL_Graphics3D DISABLED_Graphics3D
260 #else // defined(USE_AURA)
261 // In-process and NaCl tests are having flaky failures on Win: crbug.com/242252
262 #define MAYBE_IN_Graphics3D DISABLED_Graphics3D
263 #define MAYBE_OUT_Graphics3D Graphics3D
264 #define MAYBE_NACL_Graphics3D DISABLED_Graphics3D
265 #endif // defined(USE_AURA)
266 #elif defined(OS_MACOSX)
267 // These tests fail when using the legacy software mode. Reenable when the
268 // software compositor is enabled crbug.com/286038
269 #define MAYBE_IN_Graphics3D DISABLED_Graphics3D
270 #define MAYBE_OUT_Graphics3D DISABLED_Graphics3D
271 #define MAYBE_NACL_Graphics3D DISABLED_Graphics3D
272 #else
273 // The tests are failing in-process. crbug.com/280282
274 #define MAYBE_IN_Graphics3D DISABLED_Graphics3D
275 #define MAYBE_OUT_Graphics3D Graphics3D
276 #define MAYBE_NACL_Graphics3D Graphics3D
277 #endif
278 TEST_PPAPI_IN_PROCESS(MAYBE_IN_Graphics3D)
279 TEST_PPAPI_OUT_OF_PROCESS(MAYBE_OUT_Graphics3D)
280 TEST_PPAPI_NACL(MAYBE_NACL_Graphics3D)
282 TEST_PPAPI_NACL(ImageData)
284 // TCPSocket and TCPSocketPrivate tests.
285 #define RUN_TCPSOCKET_SUBTESTS \
286 RunTestViaHTTP( \
287 LIST_TEST(TCPSocket_Connect) \
288 LIST_TEST(TCPSocket_ReadWrite) \
289 LIST_TEST(TCPSocket_SetOption) \
290 LIST_TEST(TCPSocket_Listen) \
291 LIST_TEST(TCPSocket_Backlog) \
292 LIST_TEST(TCPSocket_Interface_1_0) \
295 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, TCPSocket) {
296 RUN_TCPSOCKET_SUBTESTS;
298 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, TCPSocket) {
299 RUN_TCPSOCKET_SUBTESTS;
301 #if defined(OS_MACOSX) && defined(ADDRESS_SANITIZER)
302 // Flaky on Mac ASAN: http://crbug.com/437408.
303 #define MAYBE_TCPSocket DISABLED_TCPSocket
304 #else
305 #define MAYBE_TCPSocket TCPSocket
306 #endif
307 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(MAYBE_TCPSocket)) {
308 RUN_TCPSOCKET_SUBTESTS;
310 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, TCPSocket) {
311 RUN_TCPSOCKET_SUBTESTS;
313 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
314 MAYBE_PNACL_NONSFI(TCPSocket)) {
315 RUN_TCPSOCKET_SUBTESTS;
317 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
318 MAYBE_PNACL_TRANSITIONAL_NONSFI(TCPSocket)) {
319 RUN_TCPSOCKET_SUBTESTS;
323 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(TCPServerSocketPrivate)
324 TEST_PPAPI_NACL(TCPServerSocketPrivate)
326 TEST_PPAPI_OUT_OF_PROCESS_WITH_SSL_SERVER(TCPSocketPrivate)
328 #if defined(OS_MACOSX) && defined(ADDRESS_SANITIZER)
329 // Flaky on Mac ASAN: http://crbug.com/437408.
330 #define MAYBE_TCPSocketPrivate DISABLED_TCPSocketPrivate
331 #else
332 #define MAYBE_TCPSocketPrivate TCPSocketPrivate
333 #endif
334 TEST_PPAPI_NACL_WITH_SSL_SERVER(MAYBE_TCPSocketPrivate)
336 TEST_PPAPI_OUT_OF_PROCESS_WITH_SSL_SERVER(TCPSocketPrivateTrusted)
338 // UDPSocket tests.
339 // UDPSocket_Broadcast is disabled for OSX because it requires root
340 // permissions on OSX 10.7+.
341 #if defined(OS_MACOSX)
342 #define MAYBE_UDPSocket_Broadcast DISABLED_UDPSocket_Broadcast
343 #else
344 #define MAYBE_UDPSocket_Broadcast UDPSocket_Broadcast
345 #endif
347 #define RUN_UDPSOCKET_SUBTESTS \
348 RunTestViaHTTP( \
349 LIST_TEST(UDPSocket_ReadWrite) \
350 LIST_TEST(UDPSocket_SetOption) \
351 LIST_TEST(MAYBE_UDPSocket_Broadcast) \
354 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, UDPSocket) {
355 RUN_UDPSOCKET_SUBTESTS;
357 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, UDPSocket) {
358 RUN_UDPSOCKET_SUBTESTS;
360 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(UDPSocket)) {
361 RUN_UDPSOCKET_SUBTESTS;
363 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, UDPSocket) {
364 RUN_UDPSOCKET_SUBTESTS;
366 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
367 MAYBE_PNACL_NONSFI(UDPSocket)) {
368 RUN_UDPSOCKET_SUBTESTS;
370 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
371 MAYBE_PNACL_TRANSITIONAL_NONSFI(UDPSocket)) {
372 RUN_UDPSOCKET_SUBTESTS;
376 // UDPSocketPrivate tests.
377 // UDPSocketPrivate_Broadcast is disabled for OSX because it requires root
378 // permissions on OSX 10.7+.
379 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(UDPSocketPrivate_Connect)
380 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(UDPSocketPrivate_ConnectFailure)
381 #if !defined(OS_MACOSX)
382 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(UDPSocketPrivate_Broadcast)
383 #endif // !defined(OS_MACOSX)
384 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(UDPSocketPrivate_SetSocketFeatureErrors)
385 TEST_PPAPI_NACL(UDPSocketPrivate_Connect)
386 TEST_PPAPI_NACL(UDPSocketPrivate_ConnectFailure)
387 #if !defined(OS_MACOSX)
388 TEST_PPAPI_NACL(UDPSocketPrivate_Broadcast)
389 #endif // !defined(OS_MACOSX)
390 TEST_PPAPI_NACL(UDPSocketPrivate_SetSocketFeatureErrors)
392 // Disallowed socket tests.
393 TEST_PPAPI_NACL_DISALLOWED_SOCKETS(HostResolverPrivateDisallowed)
394 TEST_PPAPI_NACL_DISALLOWED_SOCKETS(TCPServerSocketPrivateDisallowed)
395 TEST_PPAPI_NACL_DISALLOWED_SOCKETS(TCPSocketPrivateDisallowed)
396 TEST_PPAPI_NACL_DISALLOWED_SOCKETS(UDPSocketPrivateDisallowed)
398 // HostResolver and HostResolverPrivate tests.
399 #define RUN_HOST_RESOLVER_SUBTESTS \
400 RunTestViaHTTP( \
401 LIST_TEST(HostResolver_Empty) \
402 LIST_TEST(HostResolver_Resolve) \
403 LIST_TEST(HostResolver_ResolveIPv4) \
406 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, HostResolver) {
407 RUN_HOST_RESOLVER_SUBTESTS;
409 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, HostResolver) {
410 RUN_HOST_RESOLVER_SUBTESTS;
412 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(HostResolver)) {
413 RUN_HOST_RESOLVER_SUBTESTS;
415 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, HostResolver) {
416 RUN_HOST_RESOLVER_SUBTESTS;
418 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
419 MAYBE_PNACL_NONSFI(HostResolver)) {
420 RUN_HOST_RESOLVER_SUBTESTS;
422 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
423 MAYBE_PNACL_TRANSITIONAL_NONSFI(HostResolver)) {
424 RUN_HOST_RESOLVER_SUBTESTS;
427 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(HostResolverPrivate_Resolve)
428 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(HostResolverPrivate_ResolveIPv4)
429 TEST_PPAPI_NACL(HostResolverPrivate_Resolve)
430 TEST_PPAPI_NACL(HostResolverPrivate_ResolveIPv4)
432 // URLLoader tests. These are split into multiple test fixtures because if we
433 // run them all together, they tend to time out.
434 #define RUN_URLLOADER_SUBTESTS_0 \
435 RunTestViaHTTP( \
436 LIST_TEST(URLLoader_BasicGET) \
437 LIST_TEST(URLLoader_BasicPOST) \
438 LIST_TEST(URLLoader_BasicFilePOST) \
439 LIST_TEST(URLLoader_BasicFileRangePOST) \
440 LIST_TEST(URLLoader_CompoundBodyPOST) \
443 #define RUN_URLLOADER_SUBTESTS_1 \
444 RunTestViaHTTP( \
445 LIST_TEST(URLLoader_EmptyDataPOST) \
446 LIST_TEST(URLLoader_BinaryDataPOST) \
447 LIST_TEST(URLLoader_CustomRequestHeader) \
448 LIST_TEST(URLLoader_FailsBogusContentLength) \
449 LIST_TEST(URLLoader_StreamToFile) \
452 // TODO(bbudge) Fix Javascript URLs for trusted loaders.
453 // http://crbug.com/103062
454 #define RUN_URLLOADER_SUBTESTS_2 \
455 RunTestViaHTTP( \
456 LIST_TEST(URLLoader_UntrustedSameOriginRestriction) \
457 LIST_TEST(URLLoader_UntrustedCrossOriginRequest) \
458 LIST_TEST(URLLoader_UntrustedJavascriptURLRestriction) \
459 LIST_TEST(DISABLED_URLLoader_TrustedJavascriptURLRestriction) \
462 #define RUN_URLLOADER_NACL_SUBTESTS_2 \
463 RunTestViaHTTP( \
464 LIST_TEST(URLLoader_UntrustedSameOriginRestriction) \
465 LIST_TEST(URLLoader_UntrustedCrossOriginRequest) \
466 LIST_TEST(URLLoader_UntrustedJavascriptURLRestriction) \
467 LIST_TEST(DISABLED_URLLoader_TrustedJavascriptURLRestriction) \
470 #define RUN_URLLOADER_SUBTESTS_3 \
471 RunTestViaHTTP( \
472 LIST_TEST(URLLoader_UntrustedHttpRequests) \
473 LIST_TEST(URLLoader_FollowURLRedirect) \
474 LIST_TEST(URLLoader_AuditURLRedirect) \
475 LIST_TEST(URLLoader_AbortCalls) \
476 LIST_TEST(URLLoader_UntendedLoad) \
477 LIST_TEST(URLLoader_PrefetchBufferThreshold) \
480 // Note: we do not support Trusted APIs in NaCl, so these will be skipped.
481 // XRequestedWithHeader isn't trusted per-se, but the header isn't provided
482 // for NaCl and thus must be skipped.
483 #define RUN_URLLOADER_TRUSTED_SUBTESTS \
484 RunTestViaHTTP( \
485 LIST_TEST(URLLoader_TrustedSameOriginRestriction) \
486 LIST_TEST(URLLoader_TrustedCrossOriginRequest) \
487 LIST_TEST(URLLoader_TrustedHttpRequests) \
488 LIST_TEST(URLLoader_XRequestedWithHeader) \
491 IN_PROC_BROWSER_TEST_F(PPAPITest, URLLoader0) {
492 RUN_URLLOADER_SUBTESTS_0;
494 IN_PROC_BROWSER_TEST_F(PPAPITest, URLLoader1) {
495 RUN_URLLOADER_SUBTESTS_1;
497 IN_PROC_BROWSER_TEST_F(PPAPITest, URLLoader2) {
498 RUN_URLLOADER_SUBTESTS_2;
500 IN_PROC_BROWSER_TEST_F(PPAPITest, URLLoader3) {
501 RUN_URLLOADER_SUBTESTS_3;
503 IN_PROC_BROWSER_TEST_F(PPAPITest, URLLoaderTrusted) {
504 RUN_URLLOADER_TRUSTED_SUBTESTS;
506 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, URLLoader0) {
507 RUN_URLLOADER_SUBTESTS_0;
509 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, URLLoader1) {
510 RUN_URLLOADER_SUBTESTS_1;
512 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, URLLoader2) {
513 RUN_URLLOADER_SUBTESTS_2;
515 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, URLLoader3) {
516 RUN_URLLOADER_SUBTESTS_3;
518 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, URLLoaderTrusted) {
519 RUN_URLLOADER_TRUSTED_SUBTESTS;
521 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, URLLoader0) {
522 RUN_URLLOADER_SUBTESTS_0;
524 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, URLLoader1) {
525 RUN_URLLOADER_SUBTESTS_1;
527 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, URLLoader2) {
528 RUN_URLLOADER_SUBTESTS_2;
530 #if defined(OS_MACOSX) && defined(ADDRESS_SANITIZER)
531 // Flaky on Mac ASAN: http://crbug.com/437411.
532 #define MAYBE_URLLoader3 DISABLED_URLLoader3
533 #else
534 #define MAYBE_URLLoader3 URLLoader3
535 #endif
536 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_URLLoader3) {
537 RUN_URLLOADER_SUBTESTS_3;
540 // Flaky on 32-bit linux bot; http://crbug.com/308906
541 #if defined(OS_LINUX) && defined(ARCH_CPU_X86)
542 #define MAYBE_URLLoader_BasicFilePOST DISABLED_URLLoader_BasicFilePOST
543 #else
544 #define MAYBE_URLLoader_BasicFilePOST URLLoader_BasicFilePOST
545 #endif
546 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(URLLoader0)) {
547 RunTestViaHTTP(
548 LIST_TEST(URLLoader_BasicGET)
549 LIST_TEST(URLLoader_BasicPOST)
550 LIST_TEST(MAYBE_URLLoader_BasicFilePOST)
551 LIST_TEST(URLLoader_BasicFileRangePOST)
552 LIST_TEST(URLLoader_CompoundBodyPOST)
556 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(URLLoader1)) {
557 RUN_URLLOADER_SUBTESTS_1;
559 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(URLLoader2)) {
560 RUN_URLLOADER_SUBTESTS_2;
562 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(URLLoader3)) {
563 RUN_URLLOADER_SUBTESTS_3;
565 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, URLLoader0) {
566 RUN_URLLOADER_SUBTESTS_0;
568 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, URLLoader1) {
569 RUN_URLLOADER_SUBTESTS_1;
571 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, URLLoader2) {
572 RUN_URLLOADER_SUBTESTS_2;
574 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, URLLoader3) {
575 RUN_URLLOADER_SUBTESTS_3;
577 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
578 MAYBE_PNACL_NONSFI(URLLoader0)) {
579 RUN_URLLOADER_SUBTESTS_0;
581 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
582 MAYBE_PNACL_NONSFI(URLLoader1)) {
583 RUN_URLLOADER_SUBTESTS_1;
585 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
586 MAYBE_PNACL_NONSFI(URLLoader2)) {
587 RUN_URLLOADER_SUBTESTS_2;
589 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
590 MAYBE_PNACL_NONSFI(URLLoader3)) {
591 RUN_URLLOADER_SUBTESTS_3;
593 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
594 MAYBE_PNACL_TRANSITIONAL_NONSFI(URLLoader0)) {
595 RUN_URLLOADER_SUBTESTS_0;
597 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
598 MAYBE_PNACL_TRANSITIONAL_NONSFI(URLLoader1)) {
599 RUN_URLLOADER_SUBTESTS_1;
601 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
602 MAYBE_PNACL_TRANSITIONAL_NONSFI(URLLoader2)) {
603 RUN_URLLOADER_SUBTESTS_2;
605 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
606 MAYBE_PNACL_TRANSITIONAL_NONSFI(URLLoader3)) {
607 RUN_URLLOADER_SUBTESTS_3;
611 // URLRequestInfo tests.
612 TEST_PPAPI_IN_PROCESS_VIA_HTTP(URLRequest_CreateAndIsURLRequestInfo)
613 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(URLRequest_CreateAndIsURLRequestInfo)
615 // Timing out on Windows. http://crbug.com/129571
616 #if defined(OS_WIN)
617 #define MAYBE_URLRequest_CreateAndIsURLRequestInfo \
618 DISABLED_URLRequest_CreateAndIsURLRequestInfo
619 #else
620 #define MAYBE_URLRequest_CreateAndIsURLRequestInfo \
621 URLRequest_CreateAndIsURLRequestInfo
622 #endif
623 TEST_PPAPI_NACL(MAYBE_URLRequest_CreateAndIsURLRequestInfo)
625 TEST_PPAPI_IN_PROCESS_VIA_HTTP(URLRequest_SetProperty)
626 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(URLRequest_SetProperty)
627 TEST_PPAPI_NACL(URLRequest_SetProperty)
628 TEST_PPAPI_IN_PROCESS_VIA_HTTP(URLRequest_AppendDataToBody)
629 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(URLRequest_AppendDataToBody)
630 TEST_PPAPI_NACL(URLRequest_AppendDataToBody)
631 TEST_PPAPI_IN_PROCESS_VIA_HTTP(DISABLED_URLRequest_AppendFileToBody)
632 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(DISABLED_URLRequest_AppendFileToBody)
633 TEST_PPAPI_NACL(DISABLED_URLRequest_AppendFileToBody)
634 TEST_PPAPI_IN_PROCESS_VIA_HTTP(URLRequest_Stress)
635 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(URLRequest_Stress)
636 TEST_PPAPI_NACL(URLRequest_Stress)
638 TEST_PPAPI_IN_PROCESS(PaintAggregator)
639 TEST_PPAPI_OUT_OF_PROCESS(PaintAggregator)
640 TEST_PPAPI_NACL(PaintAggregator)
642 // TODO(danakj): http://crbug.com/115286
643 TEST_PPAPI_NACL(DISABLED_Scrollbar)
645 TEST_PPAPI_NACL(Var)
647 TEST_PPAPI_NACL(VarResource)
649 // PostMessage tests.
650 #define RUN_POSTMESSAGE_SUBTESTS \
651 RunTestViaHTTP( \
652 LIST_TEST(PostMessage_SendInInit) \
653 LIST_TEST(PostMessage_SendingData) \
654 LIST_TEST(PostMessage_SendingString) \
655 LIST_TEST(PostMessage_SendingArrayBuffer) \
656 LIST_TEST(PostMessage_SendingArray) \
657 LIST_TEST(PostMessage_SendingDictionary) \
658 LIST_TEST(PostMessage_SendingResource) \
659 LIST_TEST(PostMessage_SendingComplexVar) \
660 LIST_TEST(PostMessage_MessageEvent) \
661 LIST_TEST(PostMessage_NoHandler) \
662 LIST_TEST(PostMessage_ExtraParam) \
663 LIST_TEST(PostMessage_NonMainThread) \
666 // Windows defines 'PostMessage', so we have to undef it.
667 #ifdef PostMessage
668 #undef PostMessage
669 #endif
671 #if defined(OS_WIN)
672 // http://crbug.com/95557
673 #define MAYBE_PostMessage DISABLED_PostMessage
674 #else
675 #define MAYBE_PostMessage PostMessage
676 #endif
677 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, MAYBE_PostMessage) {
678 RUN_POSTMESSAGE_SUBTESTS;
680 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, PostMessage) {
681 RUN_POSTMESSAGE_SUBTESTS;
683 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(PostMessage)) {
684 RUN_POSTMESSAGE_SUBTESTS;
686 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, PostMessage) {
687 RUN_POSTMESSAGE_SUBTESTS;
689 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
690 MAYBE_PNACL_NONSFI(PostMessage)) {
691 RUN_POSTMESSAGE_SUBTESTS;
693 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
694 MAYBE_PNACL_TRANSITIONAL_NONSFI(PostMessage)) {
695 RUN_POSTMESSAGE_SUBTESTS;
698 TEST_PPAPI_NACL(Memory)
700 // FileIO tests.
701 #define RUN_FILEIO_SUBTESTS \
702 RunTestViaHTTP( \
703 LIST_TEST(FileIO_Open) \
704 LIST_TEST(FileIO_OpenDirectory) \
705 LIST_TEST(FileIO_AbortCalls) \
706 LIST_TEST(FileIO_ParallelReads) \
707 LIST_TEST(FileIO_ParallelWrites) \
708 LIST_TEST(FileIO_NotAllowMixedReadWrite) \
709 LIST_TEST(FileIO_ReadWriteSetLength) \
710 LIST_TEST(FileIO_ReadToArrayWriteSetLength) \
711 LIST_TEST(FileIO_TouchQuery) \
714 #define RUN_FILEIO_PRIVATE_SUBTESTS \
715 RunTestViaHTTP( \
716 LIST_TEST(FileIO_RequestOSFileHandle) \
717 LIST_TEST(FileIO_RequestOSFileHandleWithOpenExclusive) \
718 LIST_TEST(FileIO_Mmap) \
721 IN_PROC_BROWSER_TEST_F(PPAPITest, FileIO) {
722 RUN_FILEIO_SUBTESTS;
724 IN_PROC_BROWSER_TEST_F(PPAPIPrivateTest, FileIO_Private) {
725 RUN_FILEIO_PRIVATE_SUBTESTS;
728 // See: crbug.com/421284
729 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, DISABLED_FileIO) {
730 RUN_FILEIO_SUBTESTS;
732 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPIPrivateTest, FileIO_Private) {
733 RUN_FILEIO_PRIVATE_SUBTESTS;
736 // http://crbug.com/313401
737 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, DISABLED_FileIO) {
738 RUN_FILEIO_SUBTESTS;
740 // http://crbug.com/313401
741 IN_PROC_BROWSER_TEST_F(PPAPIPrivateNaClNewlibTest,
742 DISABLED_NaCl_Newlib_FileIO_Private) {
743 RUN_FILEIO_PRIVATE_SUBTESTS;
746 // Flaky on 32-bit linux bot; http://crbug.com/308905
747 // Flaky on Windows too; http://crbug.com/321300
748 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, DISABLED_FileIO) {
749 RUN_FILEIO_SUBTESTS;
751 IN_PROC_BROWSER_TEST_F(PPAPIPrivateNaClGLibcTest, DISABLED_FileIO_Private) {
752 RUN_FILEIO_PRIVATE_SUBTESTS;
755 // http://crbug.com/313205
756 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, DISABLED_FileIO) {
757 RUN_FILEIO_SUBTESTS;
759 IN_PROC_BROWSER_TEST_F(PPAPIPrivateNaClPNaClTest,
760 DISABLED_PNaCl_FileIO_Private) {
761 RUN_FILEIO_PRIVATE_SUBTESTS;
764 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest, MAYBE_PNACL_NONSFI(FileIO)) {
765 RUN_FILEIO_SUBTESTS;
767 IN_PROC_BROWSER_TEST_F(PPAPIPrivateNaClPNaClNonSfiTest,
768 MAYBE_PNACL_NONSFI(FILEIO_Private)) {
769 RUN_FILEIO_PRIVATE_SUBTESTS;
772 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
773 MAYBE_PNACL_TRANSITIONAL_NONSFI(FileIO)) {
774 RUN_FILEIO_SUBTESTS;
776 IN_PROC_BROWSER_TEST_F(PPAPIPrivateNaClPNaClTransitionalNonSfiTest,
777 MAYBE_PNACL_TRANSITIONAL_NONSFI(FILEIO_Private)) {
778 RUN_FILEIO_PRIVATE_SUBTESTS;
781 // PPB_FileMapping is only implemented on POSIX currently.
782 // http://crbug.com/83774
783 #if defined(OS_WIN)
784 #define MAYBE_FileMapping DISABLED_FileMapping
785 #else
786 #define MAYBE_FileMapping FileMapping
787 #endif
788 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(MAYBE_FileMapping)
789 TEST_PPAPI_NACL(MAYBE_FileMapping)
791 // FileRef tests.
792 #define RUN_FILEREF_SUBTESTS_1 \
793 RunTestViaHTTP( \
794 LIST_TEST(FileRef_Create) \
795 LIST_TEST(FileRef_GetFileSystemType) \
796 LIST_TEST(FileRef_GetName) \
797 LIST_TEST(FileRef_GetPath) \
798 LIST_TEST(FileRef_GetParent) \
799 LIST_TEST(FileRef_MakeDirectory) \
802 #define RUN_FILEREF_SUBTESTS_2 \
803 RunTestViaHTTP( \
804 LIST_TEST(FileRef_QueryAndTouchFile) \
805 LIST_TEST(FileRef_DeleteFileAndDirectory) \
806 LIST_TEST(FileRef_RenameFileAndDirectory) \
807 LIST_TEST(FileRef_Query) \
808 LIST_TEST(FileRef_FileNameEscaping) \
811 // Note, the FileRef tests are split into two, because all of them together
812 // sometimes take too long on windows: crbug.com/336999
813 IN_PROC_BROWSER_TEST_F(PPAPITest, FileRef1) {
814 RUN_FILEREF_SUBTESTS_1;
816 IN_PROC_BROWSER_TEST_F(PPAPITest, FileRef2) {
817 RUN_FILEREF_SUBTESTS_2;
819 // This test only works as an in-process test. See crbug.com/241646.
820 IN_PROC_BROWSER_TEST_F(PPAPITest, FileRef_ReadDirectoryEntries) {
821 RunTestViaHTTP(LIST_TEST(FileRef_ReadDirectoryEntries));
823 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, FileRef1) {
824 RUN_FILEREF_SUBTESTS_1;
826 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, FileRef2) {
827 RUN_FILEREF_SUBTESTS_2;
830 #if defined(OS_MACOSX) && defined(ADDRESS_SANITIZER)
831 // Flaky on Mac ASAN: http://crbug.com/437411.
832 #define MAYBE_FileRef1 DISABLED_FileRef1
833 #else
834 #define MAYBE_FileRef1 FileRef1
835 #endif
836 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_FileRef1) {
837 RUN_FILEREF_SUBTESTS_1;
839 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, FileRef2) {
840 RUN_FILEREF_SUBTESTS_2;
842 // Flaky on 32-bit linux bot; http://crbug.com/308908
843 // Glibc not available on ARM
844 #if (defined(OS_LINUX) && defined(ARCH_CPU_X86)) \
845 || defined(ARCH_CPU_ARM_FAMILY)
846 #define MAYBE_NaCl_Glibc_FileRef1 DISABLED_FileRef1
847 #define MAYBE_NaCl_Glibc_FileRef2 DISABLED_FileRef2
848 #else
849 #define MAYBE_NaCl_Glibc_FileRef1 FileRef1
850 #define MAYBE_NaCl_Glibc_FileRef2 FileRef2
851 #endif
852 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_NaCl_Glibc_FileRef1) {
853 RUN_FILEREF_SUBTESTS_1;
855 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_NaCl_Glibc_FileRef2) {
856 RUN_FILEREF_SUBTESTS_2;
858 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, FileRef1) {
859 RUN_FILEREF_SUBTESTS_1;
861 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, FileRef2) {
862 RUN_FILEREF_SUBTESTS_2;
864 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
865 MAYBE_PNACL_NONSFI(FileRef1)) {
866 RUN_FILEREF_SUBTESTS_1;
868 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
869 MAYBE_PNACL_NONSFI(FileRef2)) {
870 RUN_FILEREF_SUBTESTS_2;
872 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
873 MAYBE_PNACL_TRANSITIONAL_NONSFI(FileRef1)) {
874 RUN_FILEREF_SUBTESTS_1;
876 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
877 MAYBE_PNACL_TRANSITIONAL_NONSFI(FileRef2)) {
878 RUN_FILEREF_SUBTESTS_2;
881 TEST_PPAPI_IN_PROCESS_VIA_HTTP(FileSystem)
882 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(FileSystem)
884 // PPAPINaClTest.FileSystem times out consistently on Windows and Mac.
885 // http://crbug.com/130372
886 #if defined(OS_MACOSX) || defined(OS_WIN)
887 #define MAYBE_FileSystem DISABLED_FileSystem
888 #else
889 #define MAYBE_FileSystem FileSystem
890 #endif
892 TEST_PPAPI_NACL(MAYBE_FileSystem)
894 #if defined(OS_MACOSX)
895 // http://crbug.com/103912
896 #define MAYBE_Fullscreen DISABLED_Fullscreen
897 #elif defined(OS_LINUX)
898 // http://crbug.com/146008
899 #define MAYBE_Fullscreen DISABLED_Fullscreen
900 #elif defined(OS_WIN)
901 // http://crbug.com/342269
902 #define MAYBE_Fullscreen DISABLED_Fullscreen
903 #else
904 #define MAYBE_Fullscreen Fullscreen
905 #endif
907 TEST_PPAPI_IN_PROCESS_VIA_HTTP(MAYBE_Fullscreen)
908 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(MAYBE_Fullscreen)
909 TEST_PPAPI_NACL(MAYBE_Fullscreen)
911 TEST_PPAPI_OUT_OF_PROCESS(X509CertificatePrivate)
913 TEST_PPAPI_IN_PROCESS(UMA)
914 TEST_PPAPI_OUT_OF_PROCESS(UMA)
915 TEST_PPAPI_NACL(UMA)
917 // NetAddress tests.
918 #define RUN_NETADDRESS_SUBTESTS \
919 RunTestViaHTTP( \
920 LIST_TEST(NetAddress_IPv4Address) \
921 LIST_TEST(NetAddress_IPv6Address) \
922 LIST_TEST(NetAddress_DescribeAsString) \
925 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, NetAddress) {
926 RUN_NETADDRESS_SUBTESTS;
928 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, NetAddress) {
929 RUN_NETADDRESS_SUBTESTS;
931 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(NetAddress)) {
932 RUN_NETADDRESS_SUBTESTS;
934 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, NetAddress) {
935 RUN_NETADDRESS_SUBTESTS;
937 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
938 MAYBE_PNACL_NONSFI(NetAddress)) {
939 RUN_NETADDRESS_SUBTESTS;
941 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
942 MAYBE_PNACL_TRANSITIONAL_NONSFI(NetAddress)) {
943 RUN_NETADDRESS_SUBTESTS;
946 // NetAddressPrivate tests.
947 #define RUN_NETADDRESS_PRIVATE_SUBTESTS \
948 RunTestViaHTTP( \
949 LIST_TEST(NetAddressPrivate_AreEqual) \
950 LIST_TEST(NetAddressPrivate_AreHostsEqual) \
951 LIST_TEST(NetAddressPrivate_Describe) \
952 LIST_TEST(NetAddressPrivate_ReplacePort) \
953 LIST_TEST(NetAddressPrivate_GetAnyAddress) \
954 LIST_TEST(NetAddressPrivate_DescribeIPv6) \
955 LIST_TEST(NetAddressPrivate_GetFamily) \
956 LIST_TEST(NetAddressPrivate_GetPort) \
957 LIST_TEST(NetAddressPrivate_GetAddress) \
958 LIST_TEST(NetAddressPrivate_GetScopeID) \
961 IN_PROC_BROWSER_TEST_F(PPAPITest, NetAddressPrivate) {
962 RUN_NETADDRESS_PRIVATE_SUBTESTS;
964 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, NetAddressPrivate) {
965 RUN_NETADDRESS_PRIVATE_SUBTESTS;
968 #define RUN_NETADDRESS_PRIVATE_UNTRUSTED_SUBTESTS \
969 RunTestViaHTTP( \
970 LIST_TEST(NetAddressPrivateUntrusted_AreEqual) \
971 LIST_TEST(NetAddressPrivateUntrusted_AreHostsEqual) \
972 LIST_TEST(NetAddressPrivateUntrusted_Describe) \
973 LIST_TEST(NetAddressPrivateUntrusted_ReplacePort) \
974 LIST_TEST(NetAddressPrivateUntrusted_GetAnyAddress) \
975 LIST_TEST(NetAddressPrivateUntrusted_GetFamily) \
976 LIST_TEST(NetAddressPrivateUntrusted_GetPort) \
977 LIST_TEST(NetAddressPrivateUntrusted_GetAddress) \
980 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, NetAddressPrivate) {
981 RUN_NETADDRESS_PRIVATE_UNTRUSTED_SUBTESTS;
983 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(NetAddressPrivate)) {
984 RUN_NETADDRESS_PRIVATE_UNTRUSTED_SUBTESTS;
986 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, NetAddressPrivate) {
987 RUN_NETADDRESS_PRIVATE_UNTRUSTED_SUBTESTS;
989 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
990 MAYBE_PNACL_NONSFI(NetAddressPrivate)) {
991 RUN_NETADDRESS_PRIVATE_UNTRUSTED_SUBTESTS;
993 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
994 MAYBE_PNACL_TRANSITIONAL_NONSFI(NetAddressPrivate)) {
995 RUN_NETADDRESS_PRIVATE_UNTRUSTED_SUBTESTS;
998 // NetworkMonitor tests.
999 #define RUN_NETWORK_MONITOR_SUBTESTS \
1000 RunTestViaHTTP( \
1001 LIST_TEST(NetworkMonitor_Basic) \
1002 LIST_TEST(NetworkMonitor_2Monitors) \
1003 LIST_TEST(NetworkMonitor_DeleteInCallback) \
1006 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, NetworkMonitor) {
1007 RUN_NETWORK_MONITOR_SUBTESTS;
1009 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, NetworkMonitor) {
1010 RUN_NETWORK_MONITOR_SUBTESTS;
1012 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(NetworkMonitor)) {
1013 RUN_NETWORK_MONITOR_SUBTESTS;
1015 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, NetworkMonitor) {
1016 RUN_NETWORK_MONITOR_SUBTESTS;
1018 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
1019 MAYBE_PNACL_NONSFI(NetworkMonitor)) {
1020 RUN_NETWORK_MONITOR_SUBTESTS;
1022 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
1023 MAYBE_PNACL_TRANSITIONAL_NONSFI(NetworkMonitor)) {
1024 RUN_NETWORK_MONITOR_SUBTESTS;
1027 // Flash tests.
1028 #define RUN_FLASH_SUBTESTS \
1029 RunTestViaHTTP( \
1030 LIST_TEST(Flash_SetInstanceAlwaysOnTop) \
1031 LIST_TEST(Flash_GetCommandLineArgs) \
1034 IN_PROC_BROWSER_TEST_F(PPAPITest, Flash) {
1035 RUN_FLASH_SUBTESTS;
1037 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, Flash) {
1038 RUN_FLASH_SUBTESTS;
1041 // In-process WebSocket tests. Note, the WebSocket tests are split into two,
1042 // because all of them together sometimes take too long on windows:
1043 // crbug.com/336999
1044 #define RUN_WEBSOCKET_SUBTESTS_1 \
1045 RunTestWithWebSocketServer( \
1046 LIST_TEST(WebSocket_IsWebSocket) \
1047 LIST_TEST(WebSocket_UninitializedPropertiesAccess) \
1048 LIST_TEST(WebSocket_InvalidConnect) \
1049 LIST_TEST(WebSocket_Protocols) \
1050 LIST_TEST(WebSocket_GetURL) \
1051 LIST_TEST(WebSocket_ValidConnect) \
1052 LIST_TEST(WebSocket_InvalidClose) \
1053 LIST_TEST(WebSocket_ValidClose) \
1054 LIST_TEST(WebSocket_GetProtocol) \
1055 LIST_TEST(WebSocket_TextSendReceive) \
1056 LIST_TEST(WebSocket_BinarySendReceive) \
1057 LIST_TEST(WebSocket_StressedSendReceive) \
1058 LIST_TEST(WebSocket_BufferedAmount) \
1061 #define RUN_WEBSOCKET_SUBTESTS_2 \
1062 RunTestWithWebSocketServer( \
1063 LIST_TEST(WebSocket_AbortCallsWithCallback) \
1064 LIST_TEST(WebSocket_AbortSendMessageCall) \
1065 LIST_TEST(WebSocket_AbortCloseCall) \
1066 LIST_TEST(WebSocket_AbortReceiveMessageCall) \
1067 LIST_TEST(WebSocket_ClosedFromServerWhileSending) \
1068 LIST_TEST(WebSocket_CcInterfaces) \
1069 LIST_TEST(WebSocket_UtilityInvalidConnect) \
1070 LIST_TEST(WebSocket_UtilityProtocols) \
1071 LIST_TEST(WebSocket_UtilityGetURL) \
1072 LIST_TEST(WebSocket_UtilityValidConnect) \
1073 LIST_TEST(WebSocket_UtilityInvalidClose) \
1074 LIST_TEST(WebSocket_UtilityValidClose) \
1075 LIST_TEST(WebSocket_UtilityGetProtocol) \
1076 LIST_TEST(WebSocket_UtilityTextSendReceive) \
1077 LIST_TEST(WebSocket_UtilityBinarySendReceive) \
1078 LIST_TEST(WebSocket_UtilityBufferedAmount) \
1081 IN_PROC_BROWSER_TEST_F(PPAPITest, WebSocket1) {
1082 RUN_WEBSOCKET_SUBTESTS_1;
1084 IN_PROC_BROWSER_TEST_F(PPAPITest, WebSocket2) {
1085 RUN_WEBSOCKET_SUBTESTS_2;
1087 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, WebSocket1) {
1088 RUN_WEBSOCKET_SUBTESTS_1;
1090 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, WebSocket2) {
1091 RUN_WEBSOCKET_SUBTESTS_2;
1093 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(WebSocket1)) {
1094 RUN_WEBSOCKET_SUBTESTS_1;
1096 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(WebSocket2)) {
1097 RUN_WEBSOCKET_SUBTESTS_2;
1099 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, WebSocket1) {
1100 RUN_WEBSOCKET_SUBTESTS_1;
1102 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, WebSocket2) {
1103 RUN_WEBSOCKET_SUBTESTS_2;
1105 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, WebSocket1) {
1106 RUN_WEBSOCKET_SUBTESTS_1;
1108 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, WebSocket2) {
1109 RUN_WEBSOCKET_SUBTESTS_2;
1111 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
1112 MAYBE_PNACL_NONSFI(WebSocket1)) {
1113 RUN_WEBSOCKET_SUBTESTS_1;
1115 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
1116 MAYBE_PNACL_NONSFI(WebSocket2)) {
1117 RUN_WEBSOCKET_SUBTESTS_2;
1119 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
1120 MAYBE_PNACL_TRANSITIONAL_NONSFI(WebSocket1)) {
1121 RUN_WEBSOCKET_SUBTESTS_1;
1123 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
1124 MAYBE_PNACL_TRANSITIONAL_NONSFI(WebSocket2)) {
1125 RUN_WEBSOCKET_SUBTESTS_2;
1128 // AudioConfig tests
1129 #define RUN_AUDIO_CONFIG_SUBTESTS \
1130 RunTestViaHTTP( \
1131 LIST_TEST(AudioConfig_RecommendSampleRate) \
1132 LIST_TEST(AudioConfig_ValidConfigs) \
1133 LIST_TEST(AudioConfig_InvalidConfigs) \
1136 IN_PROC_BROWSER_TEST_F(PPAPITest, AudioConfig) {
1137 RUN_AUDIO_CONFIG_SUBTESTS;
1139 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, AudioConfig) {
1140 RUN_AUDIO_CONFIG_SUBTESTS;
1142 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, AudioConfig) {
1143 RUN_AUDIO_CONFIG_SUBTESTS;
1145 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(AudioConfig)) {
1146 RUN_AUDIO_CONFIG_SUBTESTS;
1148 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, AudioConfig) {
1149 RUN_AUDIO_CONFIG_SUBTESTS;
1151 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
1152 MAYBE_PNACL_NONSFI(AudioConfig)) {
1153 RUN_AUDIO_CONFIG_SUBTESTS;
1155 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
1156 MAYBE_PNACL_TRANSITIONAL_NONSFI(AudioConfig)) {
1157 RUN_AUDIO_CONFIG_SUBTESTS;
1160 // PPB_Audio tests.
1161 #define RUN_AUDIO_SUBTESTS \
1162 RunTestViaHTTP( \
1163 LIST_TEST(Audio_Creation) \
1164 LIST_TEST(Audio_DestroyNoStop) \
1165 LIST_TEST(Audio_Failures) \
1166 LIST_TEST(Audio_AudioCallback1) \
1167 LIST_TEST(Audio_AudioCallback2) \
1168 LIST_TEST(Audio_AudioCallback3) \
1169 LIST_TEST(Audio_AudioCallback4) \
1172 #if defined(OS_LINUX)
1173 // http://crbug.com/396464
1174 #define MAYBE_Audio DISABLED_Audio
1175 #else
1176 #define MAYBE_Audio Audio
1177 #endif
1178 // PPB_Audio is not supported in-process.
1179 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, MAYBE_Audio) {
1180 RUN_AUDIO_SUBTESTS;
1182 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, Audio) {
1183 RUN_AUDIO_SUBTESTS;
1185 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(Audio)) {
1186 RUN_AUDIO_SUBTESTS;
1188 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, Audio) {
1189 RUN_AUDIO_SUBTESTS;
1191 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
1192 MAYBE_PNACL_NONSFI(Audio)) {
1193 RUN_AUDIO_SUBTESTS;
1195 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
1196 MAYBE_PNACL_TRANSITIONAL_NONSFI(Audio)) {
1197 RUN_AUDIO_SUBTESTS;
1200 #define RUN_AUDIO_THREAD_CREATOR_SUBTESTS \
1201 RunTestViaHTTP( \
1202 LIST_TEST(Audio_AudioThreadCreatorIsRequired) \
1203 LIST_TEST(Audio_AudioThreadCreatorIsCalled) \
1206 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, AudioThreadCreator) {
1207 RUN_AUDIO_THREAD_CREATOR_SUBTESTS;
1209 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(AudioThreadCreator)) {
1210 RUN_AUDIO_THREAD_CREATOR_SUBTESTS;
1212 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, AudioThreadCreator) {
1213 RUN_AUDIO_THREAD_CREATOR_SUBTESTS;
1215 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
1216 MAYBE_PNACL_NONSFI(AudioThreadCreator)) {
1217 RUN_AUDIO_THREAD_CREATOR_SUBTESTS;
1219 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
1220 MAYBE_PNACL_TRANSITIONAL_NONSFI(AudioThreadCreator)) {
1221 RUN_AUDIO_THREAD_CREATOR_SUBTESTS;
1224 TEST_PPAPI_IN_PROCESS(View_CreatedVisible);
1225 TEST_PPAPI_OUT_OF_PROCESS(View_CreatedVisible);
1226 TEST_PPAPI_NACL(View_CreatedVisible);
1227 // This test ensures that plugins created in a background tab have their
1228 // initial visibility set to false. We don't bother testing in-process for this
1229 // custom test since the out of process code also exercises in-process.
1231 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, View_CreateInvisible) {
1232 // Make a second tab in the foreground.
1233 GURL url = GetTestFileUrl("View_CreatedInvisible");
1234 chrome::NavigateParams params(browser(), url, ui::PAGE_TRANSITION_LINK);
1235 params.disposition = NEW_BACKGROUND_TAB;
1236 ui_test_utils::NavigateToURL(&params);
1239 // This test messes with tab visibility so is custom.
1240 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, DISABLED_View_PageHideShow) {
1241 // The plugin will be loaded in the foreground tab and will send us a message.
1242 PPAPITestMessageHandler handler;
1243 content::JavascriptTestObserver observer(
1244 browser()->tab_strip_model()->GetActiveWebContents(),
1245 &handler);
1247 GURL url = GetTestFileUrl("View_PageHideShow");
1248 ui_test_utils::NavigateToURL(browser(), url);
1250 ASSERT_TRUE(observer.Run()) << handler.error_message();
1251 EXPECT_STREQ("TestPageHideShow:Created", handler.message().c_str());
1252 observer.Reset();
1254 // Make a new tab to cause the original one to hide, this should trigger the
1255 // next phase of the test.
1256 chrome::NavigateParams params(
1257 browser(), GURL(url::kAboutBlankURL), ui::PAGE_TRANSITION_LINK);
1258 params.disposition = NEW_FOREGROUND_TAB;
1259 ui_test_utils::NavigateToURL(&params);
1261 // Wait until the test acks that it got hidden.
1262 ASSERT_TRUE(observer.Run()) << handler.error_message();
1263 EXPECT_STREQ("TestPageHideShow:Hidden", handler.message().c_str());
1264 observer.Reset();
1266 // Switch back to the test tab.
1267 browser()->tab_strip_model()->ActivateTabAt(0, true);
1269 ASSERT_TRUE(observer.Run()) << handler.error_message();
1270 EXPECT_STREQ("PASS", handler.message().c_str());
1273 // Tests that if a plugin accepts touch events, the browser knows to send touch
1274 // events to the renderer.
1275 IN_PROC_BROWSER_TEST_F(PPAPITest, InputEvent_AcceptTouchEvent) {
1276 std::string positive_tests[] = { "InputEvent_AcceptTouchEvent_1",
1277 "InputEvent_AcceptTouchEvent_2",
1278 "InputEvent_AcceptTouchEvent_3",
1279 "InputEvent_AcceptTouchEvent_4"
1282 for (size_t i = 0; i < arraysize(positive_tests); ++i) {
1283 RenderViewHost* host = browser()->tab_strip_model()->
1284 GetActiveWebContents()->GetRenderViewHost();
1285 RunTest(positive_tests[i]);
1286 EXPECT_TRUE(content::RenderViewHostTester::HasTouchEventHandler(host));
1290 // View tests.
1291 #define RUN_VIEW_SUBTESTS \
1292 RunTestViaHTTP( \
1293 LIST_TEST(View_SizeChange) \
1294 LIST_TEST(View_ClipChange) \
1295 LIST_TEST(View_ScrollOffsetChange) \
1298 IN_PROC_BROWSER_TEST_F(PPAPITest, View) {
1299 RUN_VIEW_SUBTESTS;
1301 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, View) {
1302 RUN_VIEW_SUBTESTS;
1304 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, View) {
1305 RUN_VIEW_SUBTESTS;
1307 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(View)) {
1308 RUN_VIEW_SUBTESTS;
1310 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, View) {
1311 RUN_VIEW_SUBTESTS;
1313 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest, MAYBE_PNACL_NONSFI(View)) {
1314 RUN_VIEW_SUBTESTS;
1316 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTransitionalNonSfiTest,
1317 MAYBE_PNACL_TRANSITIONAL_NONSFI(View)) {
1318 RUN_VIEW_SUBTESTS;
1321 // FlashMessageLoop tests.
1322 #define RUN_FLASH_MESSAGE_LOOP_SUBTESTS \
1323 RunTest( \
1324 LIST_TEST(FlashMessageLoop_Basics) \
1325 LIST_TEST(FlashMessageLoop_RunWithoutQuit) \
1328 IN_PROC_BROWSER_TEST_F(PPAPITest, FlashMessageLoop) {
1329 RUN_FLASH_MESSAGE_LOOP_SUBTESTS;
1331 #if defined(OS_LINUX) // Disabled due to flakiness http://crbug.com/316925
1332 #define MAYBE_FlashMessageLoop DISABLED_FlashMessageLoop
1333 #else
1334 #define MAYBE_FlashMessageLoop FlashMessageLoop
1335 #endif
1336 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, MAYBE_FlashMessageLoop) {
1337 RUN_FLASH_MESSAGE_LOOP_SUBTESTS;
1340 // The compositor test timeouts sometimes, so we have to split it to two
1341 // subtests.
1342 #define RUN_COMPOSITOR_SUBTESTS_0 \
1343 RunTestViaHTTP( \
1344 LIST_TEST(Compositor_BindUnbind) \
1345 LIST_TEST(Compositor_Release) \
1346 LIST_TEST(Compositor_ReleaseUnbound) \
1347 LIST_TEST(Compositor_ReleaseWithoutCommit) \
1348 LIST_TEST(Compositor_ReleaseWithoutCommitUnbound) \
1351 #define RUN_COMPOSITOR_SUBTESTS_1 \
1352 RunTestViaHTTP( \
1353 LIST_TEST(Compositor_CommitTwoTimesWithoutChange) \
1354 LIST_TEST(Compositor_CommitTwoTimesWithoutChangeUnbound) \
1355 LIST_TEST(Compositor_General) \
1356 LIST_TEST(Compositor_GeneralUnbound) \
1359 #if defined(OS_WIN)
1360 // This test fails with the test compositor which is what's used by default for
1361 // browser tests on Windows. Renable when the software compositor is available.
1362 #define MAYBE_Compositor0 DISABLED_Compositor0
1363 #define MAYBE_Compositor1 DISABLED_Compositor1
1364 #elif defined(OS_MACOSX)
1365 // This test fails when using the legacy software mode. Reenable when the
1366 // software compositor is enabled crbug.com/286038
1367 #define MAYBE_Compositor0 DISABLED_Compositor0
1368 #define MAYBE_Compositor1 DISABLED_Compositor1
1369 #else
1370 // flaky on Linux: http://crbug.com/396482
1371 #define MAYBE_Compositor0 DISABLED_Compositor0
1372 #define MAYBE_Compositor1 DISABLED_Compositor1
1373 #endif
1375 TEST_PPAPI_NACL_SUBTESTS(MAYBE_Compositor0, RUN_COMPOSITOR_SUBTESTS_0)
1376 TEST_PPAPI_NACL_SUBTESTS(MAYBE_Compositor1, RUN_COMPOSITOR_SUBTESTS_1)
1378 #if defined(OS_WIN)
1379 // Flaky on Windows (crbug.com/438729)
1380 #define MAYBE_MediaStreamAudioTrack DISABLED_MediaStreamAudioTrack
1381 #else
1382 #define MAYBE_MediaStreamAudioTrack MediaStreamAudioTrack
1383 #endif
1384 TEST_PPAPI_NACL(MAYBE_MediaStreamAudioTrack)
1386 TEST_PPAPI_NACL(MediaStreamVideoTrack)
1388 TEST_PPAPI_NACL(MouseCursor)
1390 TEST_PPAPI_NACL(NetworkProxy)
1392 TEST_PPAPI_NACL(TrueTypeFont)
1394 TEST_PPAPI_NACL(VideoDecoder)
1396 // VideoDestination doesn't work in content_browsertests.
1397 TEST_PPAPI_OUT_OF_PROCESS(VideoDestination)
1398 TEST_PPAPI_NACL(VideoDestination)
1400 // VideoSource doesn't work in content_browsertests.
1401 TEST_PPAPI_OUT_OF_PROCESS(VideoSource)
1402 TEST_PPAPI_NACL(VideoSource)
1404 // Printing doesn't work in content_browsertests.
1405 TEST_PPAPI_OUT_OF_PROCESS(Printing)
1407 TEST_PPAPI_NACL(MessageHandler)
1409 TEST_PPAPI_NACL(MessageLoop_Basics)
1410 TEST_PPAPI_NACL(MessageLoop_Post)
1412 // Going forward, Flash APIs will only work out-of-process.
1413 TEST_PPAPI_OUT_OF_PROCESS(Flash_GetLocalTimeZoneOffset)
1414 TEST_PPAPI_OUT_OF_PROCESS(Flash_GetProxyForURL)
1415 TEST_PPAPI_OUT_OF_PROCESS(Flash_GetSetting)
1416 TEST_PPAPI_OUT_OF_PROCESS(Flash_SetCrashData)
1417 // http://crbug.com/176822
1418 #if !defined(OS_WIN)
1419 TEST_PPAPI_OUT_OF_PROCESS(FlashClipboard)
1420 #endif
1421 TEST_PPAPI_OUT_OF_PROCESS(FlashFile)
1422 // Mac/Aura reach NOTIMPLEMENTED/time out.
1423 // mac: http://crbug.com/96767
1424 // aura: http://crbug.com/104384
1425 // cros: http://crbug.com/396502
1426 #if defined(OS_MACOSX) || defined(OS_CHROMEOS)
1427 #define MAYBE_FlashFullscreen DISABLED_FlashFullscreen
1428 #else
1429 #define MAYBE_FlashFullscreen FlashFullscreen
1430 #endif
1431 TEST_PPAPI_OUT_OF_PROCESS(MAYBE_FlashFullscreen)
1433 TEST_PPAPI_OUT_OF_PROCESS(PDF)
1435 // TODO(dalecurtis): Renable once the platform verification infobar has been
1436 // implemented; see http://crbug.com/270908
1437 // #if defined(OS_CHROMEOS)
1438 // TEST_PPAPI_OUT_OF_PROCESS(PlatformVerificationPrivate)
1439 // #endif
1441 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, FlashDRM) {
1442 RunTest(
1443 #if (defined(OS_WIN) && defined(ENABLE_RLZ)) || defined(OS_CHROMEOS)
1444 // Only implemented on Windows and ChromeOS currently.
1445 LIST_TEST(FlashDRM_GetDeviceID)
1446 #endif
1447 LIST_TEST(FlashDRM_GetHmonitor)
1448 LIST_TEST(FlashDRM_GetVoucherFile));
1451 TEST_PPAPI_IN_PROCESS(TalkPrivate)
1452 TEST_PPAPI_OUT_OF_PROCESS(TalkPrivate)
1454 #if defined(OS_CHROMEOS)
1455 TEST_PPAPI_OUT_OF_PROCESS(OutputProtectionPrivate)
1456 #endif
1458 class PackagedAppTest : public ExtensionBrowserTest {
1459 public:
1460 explicit PackagedAppTest(const std::string& toolchain)
1461 : toolchain_(toolchain) { }
1463 void LaunchTestingApp() {
1464 base::FilePath data_dir;
1465 ASSERT_TRUE(PathService::Get(chrome::DIR_GEN_TEST_DATA, &data_dir));
1466 base::FilePath app_dir = data_dir.AppendASCII("ppapi")
1467 .AppendASCII("tests")
1468 .AppendASCII("extensions")
1469 .AppendASCII("packaged_app")
1470 .AppendASCII(toolchain_);
1472 const extensions::Extension* extension = LoadExtension(app_dir);
1473 ASSERT_TRUE(extension);
1475 AppLaunchParams params(browser()->profile(), extension,
1476 extensions::LAUNCH_CONTAINER_NONE, NEW_WINDOW,
1477 extensions::SOURCE_TEST);
1478 params.command_line = *base::CommandLine::ForCurrentProcess();
1479 OpenApplication(params);
1482 void RunTests() {
1483 ExtensionTestMessageListener listener("hello", true);
1484 LaunchTestingApp();
1485 EXPECT_TRUE(listener.WaitUntilSatisfied());
1487 protected:
1488 std::string toolchain_;
1491 class NewlibPackagedAppTest : public PackagedAppTest {
1492 public:
1493 NewlibPackagedAppTest() : PackagedAppTest("newlib") { }
1496 class NonSfiPackagedAppTest : public PackagedAppTest {
1497 public:
1498 NonSfiPackagedAppTest() : PackagedAppTest("nonsfi") { }
1500 void SetUpCommandLine(base::CommandLine* command_line) override {
1501 #if !defined(DISABLE_NACL)
1502 PackagedAppTest::SetUpCommandLine(command_line);
1503 command_line->AppendSwitch(switches::kEnableNaClNonSfiMode);
1504 #endif
1508 // TODO(hidehiko): Switch for NonSfi tests to use nacl_helper_nonsfi, when
1509 // it is launched officially. See NaClBrowserTestPnaclTransitionalNonSfi
1510 // for more details.
1511 class TransitionalNonSfiPackagedAppTest : public NonSfiPackagedAppTest {
1512 public:
1513 void SetUpCommandLine(base::CommandLine* command_line) override {
1514 #if !defined(DISABLE_NACL)
1515 NonSfiPackagedAppTest::SetUpCommandLine(command_line);
1516 command_line->AppendSwitch(switches::kUseNaClHelperNonSfi);
1517 #endif
1521 // Load a packaged app, and wait for it to successfully post a "hello" message
1522 // back.
1523 IN_PROC_BROWSER_TEST_F(NewlibPackagedAppTest, SuccessfulLoad) {
1524 RunTests();
1527 IN_PROC_BROWSER_TEST_F(NonSfiPackagedAppTest,
1528 MAYBE_PNACL_NONSFI(SuccessfulLoad)) {
1529 RunTests();
1532 IN_PROC_BROWSER_TEST_F(TransitionalNonSfiPackagedAppTest,
1533 MAYBE_PNACL_TRANSITIONAL_NONSFI(SuccessfulLoad)) {
1534 RunTests();
1537 #if !defined(DISABLE_NACL)
1538 class MojoPPAPITest : public InProcessBrowserTest {
1539 public:
1540 MojoPPAPITest() : InProcessBrowserTest() { }
1541 virtual ~MojoPPAPITest() { }
1543 void RunTestInternal() {
1544 base::FilePath document_root;
1545 ASSERT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&document_root));
1546 net::SpawnedTestServer http_server(net::SpawnedTestServer::TYPE_HTTP,
1547 net::SpawnedTestServer::kLocalhost,
1548 document_root);
1549 ASSERT_TRUE(http_server.Start());
1551 std::string query = "files/test_case.html?testcase=Mojo&mode=mojo";
1552 GURL test_url = http_server.GetURL(query);
1554 PPAPITestMessageHandler handler;
1555 content::JavascriptTestObserver observer(
1556 browser()->tab_strip_model()->GetActiveWebContents(),
1557 &handler);
1558 ui_test_utils::NavigateToURL(browser(), test_url);
1560 ASSERT_TRUE(observer.Run()) << handler.error_message();
1561 result_ = handler.message();
1564 void RunTest() {
1565 base::CommandLine::ForCurrentProcess()->AppendSwitch(
1566 switches::kEnableNaClMojo);
1567 RunTestInternal();
1568 EXPECT_STREQ("PASS", result_.c_str());
1570 void RunTestWithoutFlag() {
1571 RunTestInternal();
1572 EXPECT_STREQ("Plugin crashed. 'NaCl module crashed'", result_.c_str());
1574 private:
1575 std::string result_;
1578 #if defined(OS_POSIX)
1579 #define MAYBE_MOJO(test_name) test_name
1580 #else
1581 #define MAYBE_MOJO(test_name) DISABLED_##test_name
1582 #endif
1584 IN_PROC_BROWSER_TEST_F(MojoPPAPITest, MAYBE_MOJO(Mojo)) {
1585 RunTest();
1588 IN_PROC_BROWSER_TEST_F(MojoPPAPITest, MAYBE_MOJO(MojoFailsWithoutFlag)) {
1589 RunTestWithoutFlag();
1591 #endif