Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / test / ppapi / ppapi_browsertest.cc
blobad561797dffe08e3b3cb0a1ad4ca436117b305ed
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/path_service.h"
6 #include "base/test/test_timeouts.h"
7 #include "build/build_config.h"
8 #include "chrome/browser/extensions/extension_browsertest.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/browser_navigator.h"
12 #include "chrome/browser/ui/extensions/app_launch_params.h"
13 #include "chrome/browser/ui/extensions/application_launch.h"
14 #include "chrome/browser/ui/tabs/tab_strip_model.h"
15 #include "chrome/common/chrome_paths.h"
16 #include "chrome/test/base/ui_test_utils.h"
17 #include "chrome/test/nacl/nacl_browsertest_util.h"
18 #include "chrome/test/ppapi/ppapi_test.h"
19 #include "components/content_settings/core/browser/host_content_settings_map.h"
20 #include "components/nacl/common/nacl_switches.h"
21 #include "content/public/browser/web_contents.h"
22 #include "content/public/common/content_switches.h"
23 #include "content/public/common/url_constants.h"
24 #include "content/public/test/javascript_test_observer.h"
25 #include "content/public/test/test_renderer_host.h"
26 #include "extensions/common/constants.h"
27 #include "extensions/test/extension_test_message_listener.h"
28 #include "ppapi/shared_impl/test_utils.h"
30 using content::RenderViewHost;
32 // This macro finesses macro expansion to do what we want.
33 #define STRIP_PREFIXES(test_name) ppapi::StripTestPrefixes(#test_name)
34 // Turn the given token into a string. This allows us to use precompiler stuff
35 // to turn names into DISABLED_Foo, but still pass a string to RunTest.
36 #define STRINGIFY(test_name) #test_name
37 #define LIST_TEST(test_name) STRINGIFY(test_name) ","
39 // Use these macros to run the tests for a specific interface.
40 // Most interfaces should be tested with both macros.
41 #define TEST_PPAPI_OUT_OF_PROCESS(test_name) \
42 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, test_name) { \
43 RunTest(STRIP_PREFIXES(test_name)); \
46 // Similar macros that test over HTTP.
47 #define TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(test_name) \
48 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, test_name) { \
49 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
52 // Similar macros that test with an SSL server.
53 #define TEST_PPAPI_OUT_OF_PROCESS_WITH_SSL_SERVER(test_name) \
54 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, test_name) { \
55 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \
58 // Disable all NaCl tests for --disable-nacl flag and on Mac ASAN builds.
59 // Flaky on Mac ASAN:
60 // http://crbug.com/428670
62 #if defined(DISABLE_NACL) || \
63 (defined(OS_MACOSX) && defined(ADDRESS_SANITIZER)) || \
64 defined(DISABLE_NACL_BROWSERTESTS)
66 #define MAYBE_PPAPI_NACL(test_name) DISABLED_##test_name
68 #define TEST_PPAPI_NACL(test_name)
69 #define TEST_PPAPI_NACL_DISALLOWED_SOCKETS(test_name)
70 #define TEST_PPAPI_NACL_WITH_SSL_SERVER(test_name)
71 #define TEST_PPAPI_NACL_SUBTESTS(test_name, run_statement)
73 #else
75 #define MAYBE_PPAPI_NACL(test_name) test_name
77 // NaCl based PPAPI tests
78 #define TEST_PPAPI_NACL(test_name) \
79 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, test_name) { \
80 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
81 } \
82 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, test_name) { \
83 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
84 } \
85 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest, \
86 MAYBE_PNACL_NONSFI(test_name)) { \
87 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
90 // NaCl based PPAPI tests
91 #define TEST_PPAPI_NACL_SUBTESTS(test_name, run_statement) \
92 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, test_name) { \
93 run_statement; \
94 } \
95 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, test_name) { \
96 run_statement; \
97 } \
98 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest, \
99 MAYBE_PNACL_NONSFI(test_name)) { \
100 run_statement; \
103 // NaCl based PPAPI tests with disallowed socket API
104 #define TEST_PPAPI_NACL_DISALLOWED_SOCKETS(test_name) \
105 IN_PROC_BROWSER_TEST_F(PPAPINaClTestDisallowedSockets, test_name) { \
106 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
109 // NaCl based PPAPI tests with SSL server
110 #define TEST_PPAPI_NACL_WITH_SSL_SERVER(test_name) \
111 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, test_name) { \
112 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \
114 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, test_name) { \
115 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \
117 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest, \
118 MAYBE_PNACL_NONSFI(test_name)) { \
119 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \
123 #endif // DISABLE_NACL
126 // Interface tests.
129 // Flaky, http://crbug.com/111355
130 TEST_PPAPI_OUT_OF_PROCESS(DISABLED_Broker)
132 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Accept) {
133 // Accepting the infobar should grant permission to access the PPAPI broker.
134 InfoBarObserver observer(this);
135 observer.ExpectInfoBarAndAccept(true);
137 // PPB_Broker_Trusted::IsAllowed should return false before the infobar is
138 // popped and true after the infobar is popped.
139 RunTest("Broker_IsAllowedPermissionDenied");
140 RunTest("Broker_ConnectPermissionGranted");
141 RunTest("Broker_IsAllowedPermissionGranted");
143 // It should also set a content settings exception for the site.
144 GURL url = GetTestFileUrl("Broker_ConnectPermissionGranted");
145 HostContentSettingsMap* content_settings =
146 browser()->profile()->GetHostContentSettingsMap();
147 EXPECT_EQ(CONTENT_SETTING_ALLOW,
148 content_settings->GetContentSetting(
149 url, url, CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string()));
152 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Deny) {
153 // Canceling the infobar should deny permission to access the PPAPI broker.
154 InfoBarObserver observer(this);
155 observer.ExpectInfoBarAndAccept(false);
157 // PPB_Broker_Trusted::IsAllowed should return false before and after the
158 // infobar is popped.
159 RunTest("Broker_IsAllowedPermissionDenied");
160 RunTest("Broker_ConnectPermissionDenied");
161 RunTest("Broker_IsAllowedPermissionDenied");
163 // It should also set a content settings exception for the site.
164 GURL url = GetTestFileUrl("Broker_ConnectPermissionDenied");
165 HostContentSettingsMap* content_settings =
166 browser()->profile()->GetHostContentSettingsMap();
167 EXPECT_EQ(CONTENT_SETTING_BLOCK,
168 content_settings->GetContentSetting(
169 url, url, CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string()));
172 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Blocked) {
173 // Block access to the PPAPI broker.
174 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
175 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, CONTENT_SETTING_BLOCK);
177 // We shouldn't see an infobar.
178 InfoBarObserver observer(this);
180 RunTest("Broker_ConnectPermissionDenied");
181 RunTest("Broker_IsAllowedPermissionDenied");
184 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Allowed) {
185 // Always allow access to the PPAPI broker.
186 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
187 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, CONTENT_SETTING_ALLOW);
189 // We shouldn't see an infobar.
190 InfoBarObserver observer(this);
192 RunTest("Broker_ConnectPermissionGranted");
193 RunTest("Broker_IsAllowedPermissionGranted");
196 TEST_PPAPI_NACL(Console)
198 TEST_PPAPI_NACL(Core)
200 // Non-NaCl TraceEvent tests are in content/test/ppapi/ppapi_browsertest.cc.
201 TEST_PPAPI_NACL(TraceEvent)
203 TEST_PPAPI_NACL(InputEvent)
205 // Flaky on Linux and Windows. http://crbug.com/135403
206 #if defined(OS_LINUX) || defined(OS_WIN)
207 #define MAYBE_ImeInputEvent DISABLED_ImeInputEvent
208 #else
209 #define MAYBE_ImeInputEvent ImeInputEvent
210 #endif
212 TEST_PPAPI_OUT_OF_PROCESS(MAYBE_ImeInputEvent)
213 TEST_PPAPI_NACL(MAYBE_ImeInputEvent)
215 // Graphics2D_Dev isn't supported in NaCl, only test the other interfaces
216 // TODO(jhorwich) Enable when Graphics2D_Dev interfaces are proxied in NaCl.
217 TEST_PPAPI_NACL(Graphics2D_InvalidResource)
218 TEST_PPAPI_NACL(Graphics2D_InvalidSize)
219 TEST_PPAPI_NACL(Graphics2D_Humongous)
220 TEST_PPAPI_NACL(Graphics2D_InitToZero)
221 TEST_PPAPI_NACL(Graphics2D_Describe)
222 TEST_PPAPI_NACL(Graphics2D_Paint)
223 TEST_PPAPI_NACL(Graphics2D_Scroll)
224 TEST_PPAPI_NACL(Graphics2D_Replace)
225 TEST_PPAPI_NACL(Graphics2D_Flush)
226 TEST_PPAPI_NACL(Graphics2D_FlushOffscreenUpdate)
227 TEST_PPAPI_NACL(Graphics2D_BindNull)
229 #if defined(OS_WIN)
230 #if defined(USE_AURA)
231 // These tests fail with the test compositor which is what's used by default for
232 // browser tests on Windows Aura. Renable when the software compositor is
233 // available.
234 #define MAYBE_IN_Graphics3D DISABLED_Graphics3D
235 #define MAYBE_OUT_Graphics3D DISABLED_Graphics3D
236 #define MAYBE_NACL_Graphics3D DISABLED_Graphics3D
237 #else // defined(USE_AURA)
238 // In-process and NaCl tests are having flaky failures on Win: crbug.com/242252
239 #define MAYBE_IN_Graphics3D DISABLED_Graphics3D
240 #define MAYBE_OUT_Graphics3D Graphics3D
241 #define MAYBE_NACL_Graphics3D DISABLED_Graphics3D
242 #endif // defined(USE_AURA)
243 #elif defined(OS_MACOSX)
244 // These tests fail when using the legacy software mode. Reenable when the
245 // software compositor is enabled crbug.com/286038
246 #define MAYBE_IN_Graphics3D DISABLED_Graphics3D
247 #define MAYBE_OUT_Graphics3D DISABLED_Graphics3D
248 #define MAYBE_NACL_Graphics3D DISABLED_Graphics3D
249 #else
250 // The tests are failing in-process. crbug.com/280282
251 #define MAYBE_IN_Graphics3D DISABLED_Graphics3D
252 #define MAYBE_OUT_Graphics3D Graphics3D
253 #define MAYBE_NACL_Graphics3D Graphics3D
254 #endif
255 TEST_PPAPI_OUT_OF_PROCESS(MAYBE_OUT_Graphics3D)
256 TEST_PPAPI_NACL(MAYBE_NACL_Graphics3D)
258 TEST_PPAPI_NACL(ImageData)
260 // TCPSocket and TCPSocketPrivate tests.
261 #define RUN_TCPSOCKET_SUBTESTS \
262 RunTestViaHTTP( \
263 LIST_TEST(TCPSocket_Connect) \
264 LIST_TEST(TCPSocket_ReadWrite) \
265 LIST_TEST(TCPSocket_SetOption) \
266 LIST_TEST(TCPSocket_Listen) \
267 LIST_TEST(TCPSocket_Backlog) \
268 LIST_TEST(TCPSocket_Interface_1_0) \
271 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, TCPSocket) {
272 RUN_TCPSOCKET_SUBTESTS;
274 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_PPAPI_NACL(TCPSocket)) {
275 RUN_TCPSOCKET_SUBTESTS;
277 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, MAYBE_PPAPI_NACL(TCPSocket)) {
278 RUN_TCPSOCKET_SUBTESTS;
280 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
281 MAYBE_PNACL_NONSFI(TCPSocket)) {
282 RUN_TCPSOCKET_SUBTESTS;
286 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(TCPServerSocketPrivate)
287 TEST_PPAPI_NACL(TCPServerSocketPrivate)
289 TEST_PPAPI_OUT_OF_PROCESS_WITH_SSL_SERVER(TCPSocketPrivate)
291 TEST_PPAPI_NACL_WITH_SSL_SERVER(TCPSocketPrivate)
293 TEST_PPAPI_OUT_OF_PROCESS_WITH_SSL_SERVER(TCPSocketPrivateTrusted)
295 // UDPSocket tests.
296 // UDPSocket_Broadcast is disabled for OSX because it requires root
297 // permissions on OSX 10.7+.
298 #if defined(OS_MACOSX)
299 #define MAYBE_UDPSocket_Broadcast DISABLED_UDPSocket_Broadcast
300 #else
301 #define MAYBE_UDPSocket_Broadcast UDPSocket_Broadcast
302 #endif
304 #define UDPSOCKET_TEST(_test) \
305 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, _test) { \
306 RunTestViaHTTP(LIST_TEST(_test)); \
308 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_PPAPI_NACL(_test)) { \
309 RunTestViaHTTP(LIST_TEST(_test)); \
311 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(_test)) { \
312 RunTestViaHTTP(LIST_TEST(_test)); \
314 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, MAYBE_PPAPI_NACL(_test)) { \
315 RunTestViaHTTP(LIST_TEST(_test)); \
317 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest, \
318 MAYBE_PNACL_NONSFI(_test)) { \
319 RunTestViaHTTP(LIST_TEST(_test)); \
322 // Instead of one single test for all UDPSocket features (like it is done for
323 // TCPSocket), split them into multiple, making it easier to isolate which tests
324 // are failing.
325 UDPSOCKET_TEST(UDPSocket_ReadWrite)
326 UDPSOCKET_TEST(UDPSocket_SetOption)
327 UDPSOCKET_TEST(UDPSocket_SetOption_1_0)
328 UDPSOCKET_TEST(UDPSocket_SetOption_1_1)
329 UDPSOCKET_TEST(MAYBE_UDPSocket_Broadcast)
330 UDPSOCKET_TEST(UDPSocket_ParallelSend)
331 UDPSOCKET_TEST(UDPSocket_Multicast)
333 // UDPSocketPrivate tests.
334 // UDPSocketPrivate_Broadcast is disabled for OSX because it requires root
335 // permissions on OSX 10.7+.
336 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(UDPSocketPrivate_Connect)
337 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(UDPSocketPrivate_ConnectFailure)
338 #if !defined(OS_MACOSX)
339 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(UDPSocketPrivate_Broadcast)
340 #endif // !defined(OS_MACOSX)
341 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(UDPSocketPrivate_SetSocketFeatureErrors)
342 TEST_PPAPI_NACL(UDPSocketPrivate_Connect)
343 TEST_PPAPI_NACL(UDPSocketPrivate_ConnectFailure)
344 #if !defined(OS_MACOSX)
345 TEST_PPAPI_NACL(UDPSocketPrivate_Broadcast)
346 #endif // !defined(OS_MACOSX)
347 TEST_PPAPI_NACL(UDPSocketPrivate_SetSocketFeatureErrors)
349 // Disallowed socket tests.
350 TEST_PPAPI_NACL_DISALLOWED_SOCKETS(HostResolverPrivateDisallowed)
351 TEST_PPAPI_NACL_DISALLOWED_SOCKETS(TCPServerSocketPrivateDisallowed)
352 TEST_PPAPI_NACL_DISALLOWED_SOCKETS(TCPSocketPrivateDisallowed)
353 TEST_PPAPI_NACL_DISALLOWED_SOCKETS(UDPSocketPrivateDisallowed)
355 // HostResolver and HostResolverPrivate tests.
356 #define RUN_HOST_RESOLVER_SUBTESTS \
357 RunTestViaHTTP( \
358 LIST_TEST(HostResolver_Empty) \
359 LIST_TEST(HostResolver_Resolve) \
360 LIST_TEST(HostResolver_ResolveIPv4) \
363 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, HostResolver) {
364 RUN_HOST_RESOLVER_SUBTESTS;
367 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_PPAPI_NACL(HostResolver)) {
368 RUN_HOST_RESOLVER_SUBTESTS;
370 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, MAYBE_PPAPI_NACL(HostResolver)) {
371 RUN_HOST_RESOLVER_SUBTESTS;
373 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
374 MAYBE_PNACL_NONSFI(HostResolver)) {
375 RUN_HOST_RESOLVER_SUBTESTS;
378 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(HostResolverPrivate_Resolve)
379 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(HostResolverPrivate_ResolveIPv4)
380 TEST_PPAPI_NACL(HostResolverPrivate_Resolve)
381 TEST_PPAPI_NACL(HostResolverPrivate_ResolveIPv4)
383 // URLLoader tests. These are split into multiple test fixtures because if we
384 // run them all together, they tend to time out.
385 #define RUN_URLLOADER_SUBTESTS_0 \
386 RunTestViaHTTP( \
387 LIST_TEST(URLLoader_BasicGET) \
388 LIST_TEST(URLLoader_BasicPOST) \
389 LIST_TEST(URLLoader_BasicFilePOST) \
390 LIST_TEST(URLLoader_BasicFileRangePOST) \
391 LIST_TEST(URLLoader_CompoundBodyPOST) \
394 #define RUN_URLLOADER_SUBTESTS_1 \
395 RunTestViaHTTP( \
396 LIST_TEST(URLLoader_EmptyDataPOST) \
397 LIST_TEST(URLLoader_BinaryDataPOST) \
398 LIST_TEST(URLLoader_CustomRequestHeader) \
399 LIST_TEST(URLLoader_FailsBogusContentLength) \
400 LIST_TEST(URLLoader_StreamToFile) \
403 // TODO(bbudge) Fix Javascript URLs for trusted loaders.
404 // http://crbug.com/103062
405 #define RUN_URLLOADER_SUBTESTS_2 \
406 RunTestViaHTTP( \
407 LIST_TEST(URLLoader_UntrustedSameOriginRestriction) \
408 LIST_TEST(URLLoader_UntrustedCrossOriginRequest) \
409 LIST_TEST(URLLoader_UntrustedJavascriptURLRestriction) \
410 LIST_TEST(DISABLED_URLLoader_TrustedJavascriptURLRestriction) \
413 #define RUN_URLLOADER_NACL_SUBTESTS_2 \
414 RunTestViaHTTP( \
415 LIST_TEST(URLLoader_UntrustedSameOriginRestriction) \
416 LIST_TEST(URLLoader_UntrustedCrossOriginRequest) \
417 LIST_TEST(URLLoader_UntrustedJavascriptURLRestriction) \
418 LIST_TEST(DISABLED_URLLoader_TrustedJavascriptURLRestriction) \
421 #define RUN_URLLOADER_SUBTESTS_3 \
422 RunTestViaHTTP( \
423 LIST_TEST(URLLoader_UntrustedHttpRequests) \
424 LIST_TEST(URLLoader_FollowURLRedirect) \
425 LIST_TEST(URLLoader_AuditURLRedirect) \
426 LIST_TEST(URLLoader_AbortCalls) \
427 LIST_TEST(URLLoader_UntendedLoad) \
428 LIST_TEST(URLLoader_PrefetchBufferThreshold) \
431 // Note: we do not support Trusted APIs in NaCl, so these will be skipped.
432 // XRequestedWithHeader isn't trusted per-se, but the header isn't provided
433 // for NaCl and thus must be skipped.
434 #define RUN_URLLOADER_TRUSTED_SUBTESTS \
435 RunTestViaHTTP( \
436 LIST_TEST(URLLoader_TrustedSameOriginRestriction) \
437 LIST_TEST(URLLoader_TrustedCrossOriginRequest) \
438 LIST_TEST(URLLoader_TrustedHttpRequests) \
439 LIST_TEST(URLLoader_XRequestedWithHeader) \
442 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, URLLoader0) {
443 RUN_URLLOADER_SUBTESTS_0;
445 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, URLLoader1) {
446 RUN_URLLOADER_SUBTESTS_1;
448 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, URLLoader2) {
449 RUN_URLLOADER_SUBTESTS_2;
451 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, URLLoader3) {
452 RUN_URLLOADER_SUBTESTS_3;
454 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, URLLoaderTrusted) {
455 RUN_URLLOADER_TRUSTED_SUBTESTS;
457 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_PPAPI_NACL(URLLoader0)) {
458 RUN_URLLOADER_SUBTESTS_0;
460 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_PPAPI_NACL(URLLoader1)) {
461 RUN_URLLOADER_SUBTESTS_1;
464 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_PPAPI_NACL(URLLoader2)) {
465 RUN_URLLOADER_SUBTESTS_2;
467 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_PPAPI_NACL(URLLoader3)) {
468 RUN_URLLOADER_SUBTESTS_3;
471 // Flaky on 32-bit linux bot; http://crbug.com/308906
472 #if defined(OS_LINUX) && defined(ARCH_CPU_X86)
473 #define MAYBE_URLLoader_BasicFilePOST DISABLED_URLLoader_BasicFilePOST
474 #else
475 #define MAYBE_URLLoader_BasicFilePOST URLLoader_BasicFilePOST
476 #endif
478 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, MAYBE_PPAPI_NACL(URLLoader0)) {
479 RUN_URLLOADER_SUBTESTS_0;
481 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, MAYBE_PPAPI_NACL(URLLoader1)) {
482 RUN_URLLOADER_SUBTESTS_1;
484 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, MAYBE_PPAPI_NACL(URLLoader2)) {
485 RUN_URLLOADER_SUBTESTS_2;
487 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, MAYBE_PPAPI_NACL(URLLoader3)) {
488 RUN_URLLOADER_SUBTESTS_3;
490 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
491 MAYBE_PNACL_NONSFI(URLLoader0)) {
492 RUN_URLLOADER_SUBTESTS_0;
494 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
495 MAYBE_PNACL_NONSFI(URLLoader1)) {
496 RUN_URLLOADER_SUBTESTS_1;
498 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
499 MAYBE_PNACL_NONSFI(URLLoader2)) {
500 RUN_URLLOADER_SUBTESTS_2;
502 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
503 MAYBE_PNACL_NONSFI(URLLoader3)) {
504 RUN_URLLOADER_SUBTESTS_3;
508 // URLRequestInfo tests.
509 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(URLRequest_CreateAndIsURLRequestInfo)
511 // Timing out on Windows. http://crbug.com/129571
512 #if defined(OS_WIN)
513 #define MAYBE_URLRequest_CreateAndIsURLRequestInfo \
514 DISABLED_URLRequest_CreateAndIsURLRequestInfo
515 #else
516 #define MAYBE_URLRequest_CreateAndIsURLRequestInfo \
517 URLRequest_CreateAndIsURLRequestInfo
518 #endif
519 TEST_PPAPI_NACL(MAYBE_URLRequest_CreateAndIsURLRequestInfo)
521 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(URLRequest_SetProperty)
522 TEST_PPAPI_NACL(URLRequest_SetProperty)
523 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(URLRequest_AppendDataToBody)
524 TEST_PPAPI_NACL(URLRequest_AppendDataToBody)
525 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(DISABLED_URLRequest_AppendFileToBody)
526 TEST_PPAPI_NACL(DISABLED_URLRequest_AppendFileToBody)
527 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(URLRequest_Stress)
528 TEST_PPAPI_NACL(URLRequest_Stress)
530 TEST_PPAPI_OUT_OF_PROCESS(PaintAggregator)
531 TEST_PPAPI_NACL(PaintAggregator)
533 // TODO(danakj): http://crbug.com/115286
534 TEST_PPAPI_NACL(DISABLED_Scrollbar)
536 TEST_PPAPI_NACL(Var)
538 TEST_PPAPI_NACL(VarResource)
540 // PostMessage tests.
541 #define RUN_POSTMESSAGE_SUBTESTS \
542 RunTestViaHTTP( \
543 LIST_TEST(PostMessage_SendInInit) \
544 LIST_TEST(PostMessage_SendingData) \
545 LIST_TEST(PostMessage_SendingString) \
546 LIST_TEST(PostMessage_SendingArrayBuffer) \
547 LIST_TEST(PostMessage_SendingArray) \
548 LIST_TEST(PostMessage_SendingDictionary) \
549 LIST_TEST(PostMessage_SendingResource) \
550 LIST_TEST(PostMessage_SendingComplexVar) \
551 LIST_TEST(PostMessage_MessageEvent) \
552 LIST_TEST(PostMessage_NoHandler) \
553 LIST_TEST(PostMessage_ExtraParam) \
554 LIST_TEST(PostMessage_NonMainThread) \
557 // Windows defines 'PostMessage', so we have to undef it.
558 #ifdef PostMessage
559 #undef PostMessage
560 #endif
562 #if defined(OS_WIN)
563 // http://crbug.com/95557
564 #define MAYBE_PostMessage DISABLED_PostMessage
565 #else
566 #define MAYBE_PostMessage PostMessage
567 #endif
568 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, MAYBE_PostMessage) {
569 RUN_POSTMESSAGE_SUBTESTS;
572 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_PPAPI_NACL(PostMessage)) {
573 RUN_POSTMESSAGE_SUBTESTS;
575 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, MAYBE_PPAPI_NACL(PostMessage)) {
576 RUN_POSTMESSAGE_SUBTESTS;
578 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
579 MAYBE_PNACL_NONSFI(PostMessage)) {
580 RUN_POSTMESSAGE_SUBTESTS;
583 TEST_PPAPI_NACL(Memory)
585 // FileIO tests.
586 #define RUN_FILEIO_SUBTESTS \
587 RunTestViaHTTP( \
588 LIST_TEST(FileIO_Open) \
589 LIST_TEST(FileIO_OpenDirectory) \
590 LIST_TEST(FileIO_AbortCalls) \
591 LIST_TEST(FileIO_ParallelReads) \
592 LIST_TEST(FileIO_ParallelWrites) \
593 LIST_TEST(FileIO_NotAllowMixedReadWrite) \
594 LIST_TEST(FileIO_ReadWriteSetLength) \
595 LIST_TEST(FileIO_ReadToArrayWriteSetLength) \
596 LIST_TEST(FileIO_TouchQuery) \
599 #define RUN_FILEIO_PRIVATE_SUBTESTS \
600 RunTestViaHTTP( \
601 LIST_TEST(FileIO_RequestOSFileHandle) \
602 LIST_TEST(FileIO_RequestOSFileHandleWithOpenExclusive) \
603 LIST_TEST(FileIO_Mmap) \
606 IN_PROC_BROWSER_TEST_F(PPAPIPrivateTest, FileIO_Private) {
607 RUN_FILEIO_PRIVATE_SUBTESTS;
610 // See: crbug.com/421284
611 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, DISABLED_FileIO) {
612 RUN_FILEIO_SUBTESTS;
614 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPIPrivateTest, FileIO_Private) {
615 RUN_FILEIO_PRIVATE_SUBTESTS;
618 // http://crbug.com/313401
619 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, DISABLED_FileIO) {
620 RUN_FILEIO_SUBTESTS;
622 // http://crbug.com/313401
623 IN_PROC_BROWSER_TEST_F(PPAPIPrivateNaClNewlibTest,
624 DISABLED_NaCl_Newlib_FileIO_Private) {
625 RUN_FILEIO_PRIVATE_SUBTESTS;
628 // http://crbug.com/313205
629 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, DISABLED_FileIO) {
630 RUN_FILEIO_SUBTESTS;
632 IN_PROC_BROWSER_TEST_F(PPAPIPrivateNaClPNaClTest,
633 DISABLED_PNaCl_FileIO_Private) {
634 RUN_FILEIO_PRIVATE_SUBTESTS;
637 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest, MAYBE_PNACL_NONSFI(FileIO)) {
638 RUN_FILEIO_SUBTESTS;
640 IN_PROC_BROWSER_TEST_F(PPAPIPrivateNaClPNaClNonSfiTest,
641 MAYBE_PNACL_NONSFI(FILEIO_Private)) {
642 RUN_FILEIO_PRIVATE_SUBTESTS;
645 // FileRef tests.
646 #define RUN_FILEREF_SUBTESTS_1 \
647 RunTestViaHTTP( \
648 LIST_TEST(FileRef_Create) \
649 LIST_TEST(FileRef_GetFileSystemType) \
650 LIST_TEST(FileRef_GetName) \
651 LIST_TEST(FileRef_GetPath) \
652 LIST_TEST(FileRef_GetParent) \
653 LIST_TEST(FileRef_MakeDirectory) \
656 #define RUN_FILEREF_SUBTESTS_2 \
657 RunTestViaHTTP( \
658 LIST_TEST(FileRef_QueryAndTouchFile) \
659 LIST_TEST(FileRef_DeleteFileAndDirectory) \
660 LIST_TEST(FileRef_RenameFileAndDirectory) \
661 LIST_TEST(FileRef_Query) \
662 LIST_TEST(FileRef_FileNameEscaping) \
665 // Note, the FileRef tests are split into two, because all of them together
666 // sometimes take too long on windows: crbug.com/336999
667 // FileRef_ReadDirectoryEntries is flaky, so left out. See crbug.com/241646.
668 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, FileRef1) {
669 RUN_FILEREF_SUBTESTS_1;
671 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, FileRef2) {
672 RUN_FILEREF_SUBTESTS_2;
675 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_PPAPI_NACL(FileRef1)) {
676 RUN_FILEREF_SUBTESTS_1;
678 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_PPAPI_NACL(FileRef2)) {
679 RUN_FILEREF_SUBTESTS_2;
681 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, MAYBE_PPAPI_NACL(FileRef1)) {
682 RUN_FILEREF_SUBTESTS_1;
684 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, MAYBE_PPAPI_NACL(FileRef2)) {
685 RUN_FILEREF_SUBTESTS_2;
687 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
688 MAYBE_PNACL_NONSFI(FileRef1)) {
689 RUN_FILEREF_SUBTESTS_1;
691 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
692 MAYBE_PNACL_NONSFI(FileRef2)) {
693 RUN_FILEREF_SUBTESTS_2;
696 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(FileSystem)
698 // PPAPINaClTest.FileSystem times out consistently on Windows and Mac.
699 // http://crbug.com/130372
700 #if defined(OS_MACOSX) || defined(OS_WIN)
701 #define MAYBE_FileSystem DISABLED_FileSystem
702 #else
703 #define MAYBE_FileSystem FileSystem
704 #endif
706 TEST_PPAPI_NACL(MAYBE_FileSystem)
708 #if defined(OS_MACOSX)
709 // http://crbug.com/103912
710 #define MAYBE_Fullscreen DISABLED_Fullscreen
711 #elif defined(OS_LINUX)
712 // http://crbug.com/146008
713 #define MAYBE_Fullscreen DISABLED_Fullscreen
714 #elif defined(OS_WIN)
715 // http://crbug.com/342269
716 #define MAYBE_Fullscreen DISABLED_Fullscreen
717 #else
718 #define MAYBE_Fullscreen Fullscreen
719 #endif
721 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(MAYBE_Fullscreen)
722 TEST_PPAPI_NACL(MAYBE_Fullscreen)
724 TEST_PPAPI_OUT_OF_PROCESS(X509CertificatePrivate)
726 TEST_PPAPI_OUT_OF_PROCESS(UMA)
727 TEST_PPAPI_NACL(UMA)
729 // NetAddress tests.
730 #define RUN_NETADDRESS_SUBTESTS \
731 RunTestViaHTTP( \
732 LIST_TEST(NetAddress_IPv4Address) \
733 LIST_TEST(NetAddress_IPv6Address) \
734 LIST_TEST(NetAddress_DescribeAsString) \
737 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, NetAddress) {
738 RUN_NETADDRESS_SUBTESTS;
740 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_PPAPI_NACL(NetAddress)) {
741 RUN_NETADDRESS_SUBTESTS;
743 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, MAYBE_PPAPI_NACL(NetAddress)) {
744 RUN_NETADDRESS_SUBTESTS;
746 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
747 MAYBE_PNACL_NONSFI(NetAddress)) {
748 RUN_NETADDRESS_SUBTESTS;
751 // NetAddressPrivate tests.
752 #define RUN_NETADDRESS_PRIVATE_SUBTESTS \
753 RunTestViaHTTP( \
754 LIST_TEST(NetAddressPrivate_AreEqual) \
755 LIST_TEST(NetAddressPrivate_AreHostsEqual) \
756 LIST_TEST(NetAddressPrivate_Describe) \
757 LIST_TEST(NetAddressPrivate_ReplacePort) \
758 LIST_TEST(NetAddressPrivate_GetAnyAddress) \
759 LIST_TEST(NetAddressPrivate_DescribeIPv6) \
760 LIST_TEST(NetAddressPrivate_GetFamily) \
761 LIST_TEST(NetAddressPrivate_GetPort) \
762 LIST_TEST(NetAddressPrivate_GetAddress) \
763 LIST_TEST(NetAddressPrivate_GetScopeID) \
766 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, NetAddressPrivate) {
767 RUN_NETADDRESS_PRIVATE_SUBTESTS;
770 #define RUN_NETADDRESS_PRIVATE_UNTRUSTED_SUBTESTS \
771 RunTestViaHTTP( \
772 LIST_TEST(NetAddressPrivateUntrusted_AreEqual) \
773 LIST_TEST(NetAddressPrivateUntrusted_AreHostsEqual) \
774 LIST_TEST(NetAddressPrivateUntrusted_Describe) \
775 LIST_TEST(NetAddressPrivateUntrusted_ReplacePort) \
776 LIST_TEST(NetAddressPrivateUntrusted_GetAnyAddress) \
777 LIST_TEST(NetAddressPrivateUntrusted_GetFamily) \
778 LIST_TEST(NetAddressPrivateUntrusted_GetPort) \
779 LIST_TEST(NetAddressPrivateUntrusted_GetAddress) \
782 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest,
783 MAYBE_PPAPI_NACL(NetAddressPrivate)) {
784 RUN_NETADDRESS_PRIVATE_UNTRUSTED_SUBTESTS;
786 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest,
787 MAYBE_PPAPI_NACL(NetAddressPrivate)) {
788 RUN_NETADDRESS_PRIVATE_UNTRUSTED_SUBTESTS;
790 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
791 MAYBE_PNACL_NONSFI(NetAddressPrivate)) {
792 RUN_NETADDRESS_PRIVATE_UNTRUSTED_SUBTESTS;
795 // NetworkMonitor tests.
796 #define RUN_NETWORK_MONITOR_SUBTESTS \
797 RunTestViaHTTP( \
798 LIST_TEST(NetworkMonitor_Basic) \
799 LIST_TEST(NetworkMonitor_2Monitors) \
800 LIST_TEST(NetworkMonitor_DeleteInCallback) \
803 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, NetworkMonitor) {
804 RUN_NETWORK_MONITOR_SUBTESTS;
806 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_PPAPI_NACL(NetworkMonitor)) {
807 RUN_NETWORK_MONITOR_SUBTESTS;
809 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, MAYBE_PPAPI_NACL(NetworkMonitor)) {
810 RUN_NETWORK_MONITOR_SUBTESTS;
812 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
813 MAYBE_PNACL_NONSFI(NetworkMonitor)) {
814 RUN_NETWORK_MONITOR_SUBTESTS;
817 // Flash tests.
818 #define RUN_FLASH_SUBTESTS \
819 RunTestViaHTTP( \
820 LIST_TEST(Flash_SetInstanceAlwaysOnTop) \
821 LIST_TEST(Flash_GetCommandLineArgs) \
824 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, Flash) {
825 RUN_FLASH_SUBTESTS;
828 // In-process WebSocket tests. Note, the WebSocket tests are split into two,
829 // because all of them together sometimes take too long on windows:
830 // crbug.com/336999
831 #define RUN_WEBSOCKET_SUBTESTS_1 \
832 RunTestWithWebSocketServer( \
833 LIST_TEST(WebSocket_IsWebSocket) \
834 LIST_TEST(WebSocket_UninitializedPropertiesAccess) \
835 LIST_TEST(WebSocket_InvalidConnect) \
836 LIST_TEST(WebSocket_Protocols) \
837 LIST_TEST(WebSocket_GetURL) \
838 LIST_TEST(WebSocket_ValidConnect) \
839 LIST_TEST(WebSocket_InvalidClose) \
840 LIST_TEST(WebSocket_ValidClose) \
841 LIST_TEST(WebSocket_GetProtocol) \
842 LIST_TEST(WebSocket_TextSendReceive) \
843 LIST_TEST(WebSocket_BinarySendReceive) \
844 LIST_TEST(WebSocket_StressedSendReceive) \
845 LIST_TEST(WebSocket_BufferedAmount) \
848 #define RUN_WEBSOCKET_SUBTESTS_2 \
849 RunTestWithWebSocketServer( \
850 LIST_TEST(WebSocket_AbortCallsWithCallback) \
851 LIST_TEST(WebSocket_AbortSendMessageCall) \
852 LIST_TEST(WebSocket_AbortCloseCall) \
853 LIST_TEST(WebSocket_AbortReceiveMessageCall) \
854 LIST_TEST(WebSocket_ClosedFromServerWhileSending) \
855 LIST_TEST(WebSocket_CcInterfaces) \
856 LIST_TEST(WebSocket_UtilityInvalidConnect) \
857 LIST_TEST(WebSocket_UtilityProtocols) \
858 LIST_TEST(WebSocket_UtilityGetURL) \
859 LIST_TEST(WebSocket_UtilityValidConnect) \
860 LIST_TEST(WebSocket_UtilityInvalidClose) \
861 LIST_TEST(WebSocket_UtilityValidClose) \
862 LIST_TEST(WebSocket_UtilityGetProtocol) \
863 LIST_TEST(WebSocket_UtilityTextSendReceive) \
864 LIST_TEST(WebSocket_UtilityBinarySendReceive) \
865 LIST_TEST(WebSocket_UtilityBufferedAmount) \
868 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, WebSocket1) {
869 RUN_WEBSOCKET_SUBTESTS_1;
871 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, WebSocket2) {
872 RUN_WEBSOCKET_SUBTESTS_2;
874 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_PPAPI_NACL(WebSocket1)) {
875 RUN_WEBSOCKET_SUBTESTS_1;
877 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_PPAPI_NACL(WebSocket2)) {
878 RUN_WEBSOCKET_SUBTESTS_2;
880 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, MAYBE_PPAPI_NACL(WebSocket1)) {
881 RUN_WEBSOCKET_SUBTESTS_1;
883 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, MAYBE_PPAPI_NACL(WebSocket2)) {
884 RUN_WEBSOCKET_SUBTESTS_2;
886 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
887 MAYBE_PNACL_NONSFI(WebSocket1)) {
888 RUN_WEBSOCKET_SUBTESTS_1;
890 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
891 MAYBE_PNACL_NONSFI(WebSocket2)) {
892 RUN_WEBSOCKET_SUBTESTS_2;
895 // AudioConfig tests
896 #define RUN_AUDIO_CONFIG_SUBTESTS \
897 RunTestViaHTTP( \
898 LIST_TEST(AudioConfig_RecommendSampleRate) \
899 LIST_TEST(AudioConfig_ValidConfigs) \
900 LIST_TEST(AudioConfig_InvalidConfigs) \
903 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, AudioConfig) {
904 RUN_AUDIO_CONFIG_SUBTESTS;
906 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_PPAPI_NACL(AudioConfig)) {
907 RUN_AUDIO_CONFIG_SUBTESTS;
909 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(AudioConfig)) {
910 RUN_AUDIO_CONFIG_SUBTESTS;
912 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, MAYBE_PPAPI_NACL(AudioConfig)) {
913 RUN_AUDIO_CONFIG_SUBTESTS;
915 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
916 MAYBE_PNACL_NONSFI(AudioConfig)) {
917 RUN_AUDIO_CONFIG_SUBTESTS;
920 // PPB_Audio tests.
921 #define RUN_AUDIO_SUBTESTS \
922 RunTestViaHTTP( \
923 LIST_TEST(Audio_Creation) \
924 LIST_TEST(Audio_DestroyNoStop) \
925 LIST_TEST(Audio_Failures) \
926 LIST_TEST(Audio_AudioCallback1) \
927 LIST_TEST(Audio_AudioCallback2) \
928 LIST_TEST(Audio_AudioCallback3) \
929 LIST_TEST(Audio_AudioCallback4) \
932 #if defined(OS_LINUX)
933 // http://crbug.com/396464
934 #define MAYBE_Audio DISABLED_Audio
935 #else
936 #define MAYBE_Audio Audio
937 #endif
938 // PPB_Audio is not supported in-process.
939 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, MAYBE_Audio) {
940 RUN_AUDIO_SUBTESTS;
942 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_PPAPI_NACL(Audio)) {
943 RUN_AUDIO_SUBTESTS;
945 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(Audio)) {
946 RUN_AUDIO_SUBTESTS;
948 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, MAYBE_PPAPI_NACL(Audio)) {
949 RUN_AUDIO_SUBTESTS;
951 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
952 MAYBE_PNACL_NONSFI(Audio)) {
953 RUN_AUDIO_SUBTESTS;
956 #define RUN_AUDIO_THREAD_CREATOR_SUBTESTS \
957 RunTestViaHTTP( \
958 LIST_TEST(Audio_AudioThreadCreatorIsRequired) \
959 LIST_TEST(Audio_AudioThreadCreatorIsCalled) \
962 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest,
963 MAYBE_PPAPI_NACL(AudioThreadCreator)) {
964 RUN_AUDIO_THREAD_CREATOR_SUBTESTS;
966 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(AudioThreadCreator)) {
967 RUN_AUDIO_THREAD_CREATOR_SUBTESTS;
969 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest,
970 MAYBE_PPAPI_NACL(AudioThreadCreator)) {
971 RUN_AUDIO_THREAD_CREATOR_SUBTESTS;
973 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
974 MAYBE_PNACL_NONSFI(AudioThreadCreator)) {
975 RUN_AUDIO_THREAD_CREATOR_SUBTESTS;
978 TEST_PPAPI_OUT_OF_PROCESS(View_CreatedVisible);
979 #if defined(OS_MACOSX)
980 // http://crbug.com/474399
981 #define MAYBE_View_CreatedVisible DISABLED_View_CreatedVisible
982 #else
983 #define MAYBE_View_CreatedVisible View_CreatedVisible
984 #endif
985 TEST_PPAPI_NACL(MAYBE_View_CreatedVisible);
987 // This test ensures that plugins created in a background tab have their
988 // initial visibility set to false. We don't bother testing in-process for this
989 // custom test since the out of process code also exercises in-process.
990 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, View_CreateInvisible) {
991 // Make a second tab in the foreground.
992 GURL url = GetTestFileUrl("View_CreatedInvisible");
993 chrome::NavigateParams params(browser(), url, ui::PAGE_TRANSITION_LINK);
994 params.disposition = NEW_BACKGROUND_TAB;
995 ui_test_utils::NavigateToURL(&params);
998 // This test messes with tab visibility so is custom.
999 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, DISABLED_View_PageHideShow) {
1000 // The plugin will be loaded in the foreground tab and will send us a message.
1001 PPAPITestMessageHandler handler;
1002 content::JavascriptTestObserver observer(
1003 browser()->tab_strip_model()->GetActiveWebContents(),
1004 &handler);
1006 GURL url = GetTestFileUrl("View_PageHideShow");
1007 ui_test_utils::NavigateToURL(browser(), url);
1009 ASSERT_TRUE(observer.Run()) << handler.error_message();
1010 EXPECT_STREQ("TestPageHideShow:Created", handler.message().c_str());
1011 observer.Reset();
1013 // Make a new tab to cause the original one to hide, this should trigger the
1014 // next phase of the test.
1015 chrome::NavigateParams params(
1016 browser(), GURL(url::kAboutBlankURL), ui::PAGE_TRANSITION_LINK);
1017 params.disposition = NEW_FOREGROUND_TAB;
1018 ui_test_utils::NavigateToURL(&params);
1020 // Wait until the test acks that it got hidden.
1021 ASSERT_TRUE(observer.Run()) << handler.error_message();
1022 EXPECT_STREQ("TestPageHideShow:Hidden", handler.message().c_str());
1023 observer.Reset();
1025 // Switch back to the test tab.
1026 browser()->tab_strip_model()->ActivateTabAt(0, true);
1028 ASSERT_TRUE(observer.Run()) << handler.error_message();
1029 EXPECT_STREQ("PASS", handler.message().c_str());
1032 // Tests that if a plugin accepts touch events, the browser knows to send touch
1033 // events to the renderer.
1034 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, InputEvent_AcceptTouchEvent) {
1035 std::string positive_tests[] = { "InputEvent_AcceptTouchEvent_1",
1036 "InputEvent_AcceptTouchEvent_2",
1037 "InputEvent_AcceptTouchEvent_3",
1038 "InputEvent_AcceptTouchEvent_4"
1041 for (size_t i = 0; i < arraysize(positive_tests); ++i) {
1042 RenderViewHost* host = browser()->tab_strip_model()->
1043 GetActiveWebContents()->GetRenderViewHost();
1044 RunTest(positive_tests[i]);
1045 EXPECT_TRUE(content::RenderViewHostTester::HasTouchEventHandler(host));
1049 // View tests.
1050 #define RUN_VIEW_SUBTESTS \
1051 RunTestViaHTTP( \
1052 LIST_TEST(View_SizeChange) \
1053 LIST_TEST(View_ClipChange) \
1054 LIST_TEST(View_ScrollOffsetChange) \
1057 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, View) {
1058 RUN_VIEW_SUBTESTS;
1060 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_PPAPI_NACL(View)) {
1061 RUN_VIEW_SUBTESTS;
1063 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, MAYBE_PPAPI_NACL(View)) {
1064 RUN_VIEW_SUBTESTS;
1066 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest, MAYBE_PNACL_NONSFI(View)) {
1067 RUN_VIEW_SUBTESTS;
1070 // FlashMessageLoop tests.
1071 #define RUN_FLASH_MESSAGE_LOOP_SUBTESTS \
1072 RunTest( \
1073 LIST_TEST(FlashMessageLoop_Basics) \
1074 LIST_TEST(FlashMessageLoop_RunWithoutQuit) \
1077 #if defined(OS_LINUX) // Disabled due to flakiness http://crbug.com/316925
1078 #define MAYBE_FlashMessageLoop DISABLED_FlashMessageLoop
1079 #else
1080 #define MAYBE_FlashMessageLoop FlashMessageLoop
1081 #endif
1082 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, MAYBE_FlashMessageLoop) {
1083 RUN_FLASH_MESSAGE_LOOP_SUBTESTS;
1086 // The compositor test timeouts sometimes, so we have to split it to two
1087 // subtests.
1088 #define RUN_COMPOSITOR_SUBTESTS_0 \
1089 RunTestViaHTTP( \
1090 LIST_TEST(Compositor_BindUnbind) \
1091 LIST_TEST(Compositor_Release) \
1092 LIST_TEST(Compositor_ReleaseUnbound) \
1093 LIST_TEST(Compositor_ReleaseWithoutCommit) \
1094 LIST_TEST(Compositor_ReleaseWithoutCommitUnbound) \
1097 #define RUN_COMPOSITOR_SUBTESTS_1 \
1098 RunTestViaHTTP( \
1099 LIST_TEST(Compositor_CommitTwoTimesWithoutChange) \
1100 LIST_TEST(Compositor_CommitTwoTimesWithoutChangeUnbound) \
1101 LIST_TEST(Compositor_General) \
1102 LIST_TEST(Compositor_GeneralUnbound) \
1105 #if defined(OS_WIN)
1106 // This test fails with the test compositor which is what's used by default for
1107 // browser tests on Windows. Renable when the software compositor is available.
1108 #define MAYBE_Compositor0 DISABLED_Compositor0
1109 #define MAYBE_Compositor1 DISABLED_Compositor1
1110 #elif defined(OS_MACOSX)
1111 // This test fails when using the legacy software mode. Reenable when the
1112 // software compositor is enabled crbug.com/286038
1113 #define MAYBE_Compositor0 DISABLED_Compositor0
1114 #define MAYBE_Compositor1 DISABLED_Compositor1
1115 #else
1116 // flaky on Linux: http://crbug.com/396482
1117 #define MAYBE_Compositor0 DISABLED_Compositor0
1118 #define MAYBE_Compositor1 DISABLED_Compositor1
1119 #endif
1121 TEST_PPAPI_NACL_SUBTESTS(MAYBE_Compositor0, RUN_COMPOSITOR_SUBTESTS_0)
1122 TEST_PPAPI_NACL_SUBTESTS(MAYBE_Compositor1, RUN_COMPOSITOR_SUBTESTS_1)
1124 #if defined(OS_LINUX) || defined(OS_WIN) || defined(OS_CHROMEOS)
1125 // Flaky on ChromeOS, Linux and Windows (crbug.com/438729)
1126 #define MAYBE_MediaStreamAudioTrack DISABLED_MediaStreamAudioTrack
1127 #else
1128 #define MAYBE_MediaStreamAudioTrack MediaStreamAudioTrack
1129 #endif
1130 TEST_PPAPI_NACL(MAYBE_MediaStreamAudioTrack)
1132 TEST_PPAPI_NACL(MediaStreamVideoTrack)
1134 TEST_PPAPI_NACL(MouseCursor)
1136 TEST_PPAPI_NACL(NetworkProxy)
1138 TEST_PPAPI_NACL(TrueTypeFont)
1140 TEST_PPAPI_NACL(VideoDecoder)
1142 TEST_PPAPI_NACL(VideoEncoder)
1144 // VideoDestination doesn't work in content_browsertests.
1145 TEST_PPAPI_OUT_OF_PROCESS(VideoDestination)
1146 TEST_PPAPI_NACL(VideoDestination)
1148 // VideoSource doesn't work in content_browsertests.
1149 TEST_PPAPI_OUT_OF_PROCESS(VideoSource)
1150 TEST_PPAPI_NACL(VideoSource)
1152 // Printing doesn't work in content_browsertests.
1153 TEST_PPAPI_OUT_OF_PROCESS(Printing)
1155 TEST_PPAPI_NACL(MessageHandler)
1157 TEST_PPAPI_NACL(MessageLoop_Basics)
1158 TEST_PPAPI_NACL(MessageLoop_Post)
1160 // Going forward, Flash APIs will only work out-of-process.
1161 TEST_PPAPI_OUT_OF_PROCESS(Flash_GetLocalTimeZoneOffset)
1162 TEST_PPAPI_OUT_OF_PROCESS(Flash_GetProxyForURL)
1163 TEST_PPAPI_OUT_OF_PROCESS(Flash_GetSetting)
1164 TEST_PPAPI_OUT_OF_PROCESS(Flash_SetCrashData)
1165 // http://crbug.com/176822
1166 #if !defined(OS_WIN)
1167 TEST_PPAPI_OUT_OF_PROCESS(FlashClipboard)
1168 #endif
1169 TEST_PPAPI_OUT_OF_PROCESS(FlashFile)
1170 // Mac/Aura reach NOTIMPLEMENTED/time out.
1171 // mac: http://crbug.com/96767
1172 // aura: http://crbug.com/104384
1173 // cros: http://crbug.com/396502
1174 #if defined(OS_MACOSX) || defined(OS_CHROMEOS)
1175 #define MAYBE_FlashFullscreen DISABLED_FlashFullscreen
1176 #else
1177 #define MAYBE_FlashFullscreen FlashFullscreen
1178 #endif
1179 TEST_PPAPI_OUT_OF_PROCESS(MAYBE_FlashFullscreen)
1181 TEST_PPAPI_OUT_OF_PROCESS(PDF)
1183 // TODO(dalecurtis): Renable once the platform verification infobar has been
1184 // implemented; see http://crbug.com/270908
1185 // #if defined(OS_CHROMEOS)
1186 // TEST_PPAPI_OUT_OF_PROCESS(PlatformVerificationPrivate)
1187 // #endif
1189 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, FlashDRM) {
1190 RunTest(
1191 #if (defined(OS_WIN) && defined(ENABLE_RLZ)) || defined(OS_CHROMEOS)
1192 // Only implemented on Windows and ChromeOS currently.
1193 LIST_TEST(FlashDRM_GetDeviceID)
1194 #endif
1195 LIST_TEST(FlashDRM_GetHmonitor)
1196 LIST_TEST(FlashDRM_GetVoucherFile));
1199 #if defined(OS_CHROMEOS)
1200 TEST_PPAPI_OUT_OF_PROCESS(OutputProtectionPrivate)
1201 #endif
1203 #if !defined(DISABLE_NACL)
1204 class PackagedAppTest : public ExtensionBrowserTest {
1205 public:
1206 explicit PackagedAppTest(const std::string& toolchain)
1207 : toolchain_(toolchain) { }
1209 void LaunchTestingApp(const std::string& extension_dirname) {
1210 base::FilePath data_dir;
1211 ASSERT_TRUE(PathService::Get(chrome::DIR_GEN_TEST_DATA, &data_dir));
1212 base::FilePath app_dir = data_dir.AppendASCII("ppapi")
1213 .AppendASCII("tests")
1214 .AppendASCII("extensions")
1215 .AppendASCII(extension_dirname)
1216 .AppendASCII(toolchain_);
1218 const extensions::Extension* extension = LoadExtension(app_dir);
1219 ASSERT_TRUE(extension);
1221 AppLaunchParams params(browser()->profile(), extension,
1222 extensions::LAUNCH_CONTAINER_NONE, NEW_WINDOW,
1223 extensions::SOURCE_TEST);
1224 params.command_line = *base::CommandLine::ForCurrentProcess();
1225 OpenApplication(params);
1228 void RunTests(const std::string& extension_dirname) {
1229 ExtensionTestMessageListener listener("PASS", true);
1230 LaunchTestingApp(extension_dirname);
1231 EXPECT_TRUE(listener.WaitUntilSatisfied());
1233 protected:
1234 std::string toolchain_;
1237 class NewlibPackagedAppTest : public PackagedAppTest {
1238 public:
1239 NewlibPackagedAppTest() : PackagedAppTest("newlib") { }
1242 class NonSfiPackagedAppTest : public PackagedAppTest {
1243 public:
1244 NonSfiPackagedAppTest() : PackagedAppTest("nonsfi") { }
1246 void SetUpCommandLine(base::CommandLine* command_line) override {
1247 PackagedAppTest::SetUpCommandLine(command_line);
1248 command_line->AppendSwitch(switches::kEnableNaClNonSfiMode);
1252 // Load a packaged app, and wait for it to successfully post a "hello" message
1253 // back.
1254 IN_PROC_BROWSER_TEST_F(NewlibPackagedAppTest,
1255 MAYBE_PPAPI_NACL(SuccessfulLoad)) {
1256 RunTests("packaged_app");
1259 IN_PROC_BROWSER_TEST_F(NonSfiPackagedAppTest,
1260 MAYBE_PNACL_NONSFI(SuccessfulLoad)) {
1261 RunTests("packaged_app");
1264 IN_PROC_BROWSER_TEST_F(NewlibPackagedAppTest,
1265 MAYBE_PPAPI_NACL(MulticastPermissions)) {
1266 RunTests("multicast_permissions");
1269 IN_PROC_BROWSER_TEST_F(NewlibPackagedAppTest,
1270 MAYBE_PPAPI_NACL(NoSocketPermissions)) {
1271 RunTests("no_socket_permissions");
1274 IN_PROC_BROWSER_TEST_F(NewlibPackagedAppTest,
1275 MAYBE_PPAPI_NACL(SocketPermissions)) {
1276 RunTests("socket_permissions");
1279 #endif