Roll src/third_party/WebKit bf18a82:a9cee16 (svn 185297:185304)
[chromium-blink-merge.git] / chrome / test / ppapi / ppapi_browsertest.cc
blob47157b6040565cfe03ce3f4d6419939a1b67d0c4
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 "content/public/browser/web_contents.h"
21 #include "content/public/common/url_constants.h"
22 #include "content/public/test/javascript_test_observer.h"
23 #include "content/public/test/test_renderer_host.h"
24 #include "extensions/test/extension_test_message_listener.h"
25 #include "ppapi/shared_impl/test_harness_utils.h"
27 using content::RenderViewHost;
29 // This macro finesses macro expansion to do what we want.
30 #define STRIP_PREFIXES(test_name) ppapi::StripTestPrefixes(#test_name)
31 // Turn the given token into a string. This allows us to use precompiler stuff
32 // to turn names into DISABLED_Foo, but still pass a string to RunTest.
33 #define STRINGIFY(test_name) #test_name
34 #define LIST_TEST(test_name) STRINGIFY(test_name) ","
36 // Use these macros to run the tests for a specific interface.
37 // Most interfaces should be tested with both macros.
38 #define TEST_PPAPI_IN_PROCESS(test_name) \
39 IN_PROC_BROWSER_TEST_F(PPAPITest, test_name) { \
40 RunTest(STRIP_PREFIXES(test_name)); \
42 #define TEST_PPAPI_OUT_OF_PROCESS(test_name) \
43 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, test_name) { \
44 RunTest(STRIP_PREFIXES(test_name)); \
47 // Similar macros that test over HTTP.
48 #define TEST_PPAPI_IN_PROCESS_VIA_HTTP(test_name) \
49 IN_PROC_BROWSER_TEST_F(PPAPITest, test_name) { \
50 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
52 #define TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(test_name) \
53 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, test_name) { \
54 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
57 // Similar macros that test with an SSL server.
58 #define TEST_PPAPI_IN_PROCESS_WITH_SSL_SERVER(test_name) \
59 IN_PROC_BROWSER_TEST_F(PPAPITest, test_name) { \
60 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \
62 #define TEST_PPAPI_OUT_OF_PROCESS_WITH_SSL_SERVER(test_name) \
63 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, test_name) { \
64 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \
67 #if defined(DISABLE_NACL)
69 #define TEST_PPAPI_NACL(test_name)
70 #define TEST_PPAPI_NACL_DISALLOWED_SOCKETS(test_name)
71 #define TEST_PPAPI_NACL_WITH_SSL_SERVER(test_name)
72 #define TEST_PPAPI_NACL_SUBTESTS(test_name, run_statement)
74 #else
76 // NaCl based PPAPI tests
77 #define TEST_PPAPI_NACL(test_name) \
78 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, test_name) { \
79 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
80 } \
81 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(test_name)) { \
82 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
83 } \
84 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, test_name) { \
85 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
86 } \
87 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest, \
88 MAYBE_PNACL_NONSFI(test_name)) { \
89 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
92 // NaCl based PPAPI tests
93 #define TEST_PPAPI_NACL_SUBTESTS(test_name, run_statement) \
94 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, test_name) { \
95 run_statement; \
96 } \
97 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(test_name)) { \
98 run_statement; \
99 } \
100 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, test_name) { \
101 run_statement; \
103 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest, \
104 MAYBE_PNACL_NONSFI(test_name)) { \
105 run_statement; \
108 // NaCl based PPAPI tests with disallowed socket API
109 #define TEST_PPAPI_NACL_DISALLOWED_SOCKETS(test_name) \
110 IN_PROC_BROWSER_TEST_F(PPAPINaClTestDisallowedSockets, test_name) { \
111 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
114 // NaCl based PPAPI tests with SSL server
115 #define TEST_PPAPI_NACL_WITH_SSL_SERVER(test_name) \
116 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, test_name) { \
117 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \
119 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(test_name)) { \
120 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \
122 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, test_name) { \
123 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \
125 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest, \
126 MAYBE_PNACL_NONSFI(test_name)) { \
127 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \
130 #endif // DISABLE_NACL
133 // Interface tests.
136 TEST_PPAPI_IN_PROCESS(Broker)
137 // Flaky, http://crbug.com/111355
138 TEST_PPAPI_OUT_OF_PROCESS(DISABLED_Broker)
140 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Accept) {
141 // Accepting the infobar should grant permission to access the PPAPI broker.
142 InfoBarObserver observer(this);
143 observer.ExpectInfoBarAndAccept(true);
145 // PPB_Broker_Trusted::IsAllowed should return false before the infobar is
146 // popped and true after the infobar is popped.
147 RunTest("Broker_IsAllowedPermissionDenied");
148 RunTest("Broker_ConnectPermissionGranted");
149 RunTest("Broker_IsAllowedPermissionGranted");
151 // It should also set a content settings exception for the site.
152 GURL url = GetTestFileUrl("Broker_ConnectPermissionGranted");
153 HostContentSettingsMap* content_settings =
154 browser()->profile()->GetHostContentSettingsMap();
155 EXPECT_EQ(CONTENT_SETTING_ALLOW,
156 content_settings->GetContentSetting(
157 url, url, CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string()));
160 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Deny) {
161 // Canceling the infobar should deny permission to access the PPAPI broker.
162 InfoBarObserver observer(this);
163 observer.ExpectInfoBarAndAccept(false);
165 // PPB_Broker_Trusted::IsAllowed should return false before and after the
166 // infobar is popped.
167 RunTest("Broker_IsAllowedPermissionDenied");
168 RunTest("Broker_ConnectPermissionDenied");
169 RunTest("Broker_IsAllowedPermissionDenied");
171 // It should also set a content settings exception for the site.
172 GURL url = GetTestFileUrl("Broker_ConnectPermissionDenied");
173 HostContentSettingsMap* content_settings =
174 browser()->profile()->GetHostContentSettingsMap();
175 EXPECT_EQ(CONTENT_SETTING_BLOCK,
176 content_settings->GetContentSetting(
177 url, url, CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string()));
180 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Blocked) {
181 // Block access to the PPAPI broker.
182 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
183 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, CONTENT_SETTING_BLOCK);
185 // We shouldn't see an infobar.
186 InfoBarObserver observer(this);
188 RunTest("Broker_ConnectPermissionDenied");
189 RunTest("Broker_IsAllowedPermissionDenied");
192 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Allowed) {
193 // Always allow access to the PPAPI broker.
194 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
195 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, CONTENT_SETTING_ALLOW);
197 // We shouldn't see an infobar.
198 InfoBarObserver observer(this);
200 RunTest("Broker_ConnectPermissionGranted");
201 RunTest("Broker_IsAllowedPermissionGranted");
204 TEST_PPAPI_NACL(Console)
206 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA)
207 // TODO(erg): linux_aura bringup: http://crbug.com/318961
208 #define MAYBE_Core DISABLED_Core
209 #else
210 #define MAYBE_Core Core
211 #endif
212 TEST_PPAPI_NACL(MAYBE_Core)
214 // Non-NaCl TraceEvent tests are in content/test/ppapi/ppapi_browsertest.cc.
215 TEST_PPAPI_NACL(TraceEvent)
217 TEST_PPAPI_NACL(InputEvent)
219 // Flaky on Linux and Windows. http://crbug.com/135403
220 #if defined(OS_LINUX) || defined(OS_WIN)
221 #define MAYBE_ImeInputEvent DISABLED_ImeInputEvent
222 #else
223 #define MAYBE_ImeInputEvent ImeInputEvent
224 #endif
226 TEST_PPAPI_OUT_OF_PROCESS(MAYBE_ImeInputEvent)
227 TEST_PPAPI_NACL(MAYBE_ImeInputEvent)
229 // Graphics2D_Dev isn't supported in NaCl, only test the other interfaces
230 // TODO(jhorwich) Enable when Graphics2D_Dev interfaces are proxied in NaCl.
231 TEST_PPAPI_NACL(Graphics2D_InvalidResource)
232 TEST_PPAPI_NACL(Graphics2D_InvalidSize)
233 TEST_PPAPI_NACL(Graphics2D_Humongous)
234 TEST_PPAPI_NACL(Graphics2D_InitToZero)
235 TEST_PPAPI_NACL(Graphics2D_Describe)
236 TEST_PPAPI_NACL(Graphics2D_Paint)
237 TEST_PPAPI_NACL(Graphics2D_Scroll)
238 TEST_PPAPI_NACL(Graphics2D_Replace)
239 TEST_PPAPI_NACL(Graphics2D_Flush)
240 TEST_PPAPI_NACL(Graphics2D_FlushOffscreenUpdate)
241 TEST_PPAPI_NACL(Graphics2D_BindNull)
243 #if defined(OS_WIN)
244 #if defined(USE_AURA)
245 // These tests fail with the test compositor which is what's used by default for
246 // browser tests on Windows Aura. Renable when the software compositor is
247 // available.
248 #define MAYBE_IN_Graphics3D DISABLED_Graphics3D
249 #define MAYBE_OUT_Graphics3D DISABLED_Graphics3D
250 #define MAYBE_NACL_Graphics3D DISABLED_Graphics3D
251 #else // defined(USE_AURA)
252 // In-process and NaCl tests are having flaky failures on Win: crbug.com/242252
253 #define MAYBE_IN_Graphics3D DISABLED_Graphics3D
254 #define MAYBE_OUT_Graphics3D Graphics3D
255 #define MAYBE_NACL_Graphics3D DISABLED_Graphics3D
256 #endif // defined(USE_AURA)
257 #elif defined(OS_MACOSX)
258 // These tests fail when using the legacy software mode. Reenable when the
259 // software compositor is enabled crbug.com/286038
260 #define MAYBE_IN_Graphics3D DISABLED_Graphics3D
261 #define MAYBE_OUT_Graphics3D DISABLED_Graphics3D
262 #define MAYBE_NACL_Graphics3D DISABLED_Graphics3D
263 #else
264 // The tests are failing in-process. crbug.com/280282
265 #define MAYBE_IN_Graphics3D DISABLED_Graphics3D
266 #define MAYBE_OUT_Graphics3D Graphics3D
267 #define MAYBE_NACL_Graphics3D Graphics3D
268 #endif
269 TEST_PPAPI_IN_PROCESS(MAYBE_IN_Graphics3D)
270 TEST_PPAPI_OUT_OF_PROCESS(MAYBE_OUT_Graphics3D)
271 TEST_PPAPI_NACL(MAYBE_NACL_Graphics3D)
273 TEST_PPAPI_NACL(ImageData)
275 // TCPSocket and TCPSocketPrivate tests.
276 #define RUN_TCPSOCKET_SUBTESTS \
277 RunTestViaHTTP( \
278 LIST_TEST(TCPSocket_Connect) \
279 LIST_TEST(TCPSocket_ReadWrite) \
280 LIST_TEST(TCPSocket_SetOption) \
281 LIST_TEST(TCPSocket_Listen) \
282 LIST_TEST(TCPSocket_Backlog) \
283 LIST_TEST(TCPSocket_Interface_1_0) \
286 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, TCPSocket) {
287 RUN_TCPSOCKET_SUBTESTS;
289 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, TCPSocket) {
290 RUN_TCPSOCKET_SUBTESTS;
292 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(TCPSocket)) {
293 RUN_TCPSOCKET_SUBTESTS;
295 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, TCPSocket) {
296 RUN_TCPSOCKET_SUBTESTS;
298 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
299 MAYBE_PNACL_NONSFI(TCPSocket)) {
300 RUN_TCPSOCKET_SUBTESTS;
303 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(TCPServerSocketPrivate)
304 TEST_PPAPI_NACL(TCPServerSocketPrivate)
306 TEST_PPAPI_OUT_OF_PROCESS_WITH_SSL_SERVER(TCPSocketPrivate)
307 TEST_PPAPI_NACL_WITH_SSL_SERVER(TCPSocketPrivate)
309 TEST_PPAPI_OUT_OF_PROCESS_WITH_SSL_SERVER(TCPSocketPrivateTrusted)
311 // UDPSocket tests.
312 // UDPSocket_Broadcast is disabled for OSX because it requires root
313 // permissions on OSX 10.7+.
314 #if defined(OS_MACOSX)
315 #define MAYBE_UDPSocket_Broadcast DISABLED_UDPSocket_Broadcast
316 #else
317 #define MAYBE_UDPSocket_Broadcast UDPSocket_Broadcast
318 #endif
320 #define RUN_UDPSOCKET_SUBTESTS \
321 RunTestViaHTTP( \
322 LIST_TEST(UDPSocket_ReadWrite) \
323 LIST_TEST(UDPSocket_SetOption) \
324 LIST_TEST(MAYBE_UDPSocket_Broadcast) \
327 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, UDPSocket) {
328 RUN_UDPSOCKET_SUBTESTS;
330 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, UDPSocket) {
331 RUN_UDPSOCKET_SUBTESTS;
333 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(UDPSocket)) {
334 RUN_UDPSOCKET_SUBTESTS;
336 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, UDPSocket) {
337 RUN_UDPSOCKET_SUBTESTS;
339 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
340 MAYBE_PNACL_NONSFI(UDPSocket)) {
341 RUN_UDPSOCKET_SUBTESTS;
345 // UDPSocketPrivate tests.
346 // UDPSocketPrivate_Broadcast is disabled for OSX because it requires root
347 // permissions on OSX 10.7+.
348 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(UDPSocketPrivate_Connect)
349 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(UDPSocketPrivate_ConnectFailure)
350 #if !defined(OS_MACOSX)
351 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(UDPSocketPrivate_Broadcast)
352 #endif // !defined(OS_MACOSX)
353 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(UDPSocketPrivate_SetSocketFeatureErrors)
354 TEST_PPAPI_NACL(UDPSocketPrivate_Connect)
355 TEST_PPAPI_NACL(UDPSocketPrivate_ConnectFailure)
356 #if !defined(OS_MACOSX)
357 TEST_PPAPI_NACL(UDPSocketPrivate_Broadcast)
358 #endif // !defined(OS_MACOSX)
359 TEST_PPAPI_NACL(UDPSocketPrivate_SetSocketFeatureErrors)
361 // Disallowed socket tests.
362 TEST_PPAPI_NACL_DISALLOWED_SOCKETS(HostResolverPrivateDisallowed)
363 TEST_PPAPI_NACL_DISALLOWED_SOCKETS(TCPServerSocketPrivateDisallowed)
364 TEST_PPAPI_NACL_DISALLOWED_SOCKETS(TCPSocketPrivateDisallowed)
365 TEST_PPAPI_NACL_DISALLOWED_SOCKETS(UDPSocketPrivateDisallowed)
367 // HostResolver and HostResolverPrivate tests.
368 #define RUN_HOST_RESOLVER_SUBTESTS \
369 RunTestViaHTTP( \
370 LIST_TEST(HostResolver_Empty) \
371 LIST_TEST(HostResolver_Resolve) \
372 LIST_TEST(HostResolver_ResolveIPv4) \
375 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, HostResolver) {
376 RUN_HOST_RESOLVER_SUBTESTS;
378 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, HostResolver) {
379 RUN_HOST_RESOLVER_SUBTESTS;
381 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(HostResolver)) {
382 RUN_HOST_RESOLVER_SUBTESTS;
384 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, HostResolver) {
385 RUN_HOST_RESOLVER_SUBTESTS;
387 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
388 MAYBE_PNACL_NONSFI(HostResolver)) {
389 RUN_HOST_RESOLVER_SUBTESTS;
392 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(HostResolverPrivate_Resolve)
393 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(HostResolverPrivate_ResolveIPv4)
394 TEST_PPAPI_NACL(HostResolverPrivate_Resolve)
395 TEST_PPAPI_NACL(HostResolverPrivate_ResolveIPv4)
397 // URLLoader tests. These are split into multiple test fixtures because if we
398 // run them all together, they tend to time out.
399 #define RUN_URLLOADER_SUBTESTS_0 \
400 RunTestViaHTTP( \
401 LIST_TEST(URLLoader_BasicGET) \
402 LIST_TEST(URLLoader_BasicPOST) \
403 LIST_TEST(URLLoader_BasicFilePOST) \
404 LIST_TEST(URLLoader_BasicFileRangePOST) \
405 LIST_TEST(URLLoader_CompoundBodyPOST) \
408 #define RUN_URLLOADER_SUBTESTS_1 \
409 RunTestViaHTTP( \
410 LIST_TEST(URLLoader_EmptyDataPOST) \
411 LIST_TEST(URLLoader_BinaryDataPOST) \
412 LIST_TEST(URLLoader_CustomRequestHeader) \
413 LIST_TEST(URLLoader_FailsBogusContentLength) \
414 LIST_TEST(URLLoader_StreamToFile) \
417 // TODO(bbudge) Fix Javascript URLs for trusted loaders.
418 // http://crbug.com/103062
419 #define RUN_URLLOADER_SUBTESTS_2 \
420 RunTestViaHTTP( \
421 LIST_TEST(URLLoader_UntrustedSameOriginRestriction) \
422 LIST_TEST(URLLoader_UntrustedCrossOriginRequest) \
423 LIST_TEST(URLLoader_UntrustedJavascriptURLRestriction) \
424 LIST_TEST(DISABLED_URLLoader_TrustedJavascriptURLRestriction) \
427 #define RUN_URLLOADER_NACL_SUBTESTS_2 \
428 RunTestViaHTTP( \
429 LIST_TEST(URLLoader_UntrustedSameOriginRestriction) \
430 LIST_TEST(URLLoader_UntrustedCrossOriginRequest) \
431 LIST_TEST(URLLoader_UntrustedJavascriptURLRestriction) \
432 LIST_TEST(DISABLED_URLLoader_TrustedJavascriptURLRestriction) \
435 #define RUN_URLLOADER_SUBTESTS_3 \
436 RunTestViaHTTP( \
437 LIST_TEST(URLLoader_UntrustedHttpRequests) \
438 LIST_TEST(URLLoader_FollowURLRedirect) \
439 LIST_TEST(URLLoader_AuditURLRedirect) \
440 LIST_TEST(URLLoader_AbortCalls) \
441 LIST_TEST(URLLoader_UntendedLoad) \
442 LIST_TEST(URLLoader_PrefetchBufferThreshold) \
445 // Note: we do not support Trusted APIs in NaCl, so these will be skipped.
446 // XRequestedWithHeader isn't trusted per-se, but the header isn't provided
447 // for NaCl and thus must be skipped.
448 #define RUN_URLLOADER_TRUSTED_SUBTESTS \
449 RunTestViaHTTP( \
450 LIST_TEST(URLLoader_TrustedSameOriginRestriction) \
451 LIST_TEST(URLLoader_TrustedCrossOriginRequest) \
452 LIST_TEST(URLLoader_TrustedHttpRequests) \
453 LIST_TEST(URLLoader_XRequestedWithHeader) \
456 IN_PROC_BROWSER_TEST_F(PPAPITest, URLLoader0) {
457 RUN_URLLOADER_SUBTESTS_0;
459 IN_PROC_BROWSER_TEST_F(PPAPITest, URLLoader1) {
460 RUN_URLLOADER_SUBTESTS_1;
462 IN_PROC_BROWSER_TEST_F(PPAPITest, URLLoader2) {
463 RUN_URLLOADER_SUBTESTS_2;
465 IN_PROC_BROWSER_TEST_F(PPAPITest, URLLoader3) {
466 RUN_URLLOADER_SUBTESTS_3;
468 IN_PROC_BROWSER_TEST_F(PPAPITest, URLLoaderTrusted) {
469 RUN_URLLOADER_TRUSTED_SUBTESTS;
471 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, URLLoader0) {
472 RUN_URLLOADER_SUBTESTS_0;
474 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, URLLoader1) {
475 RUN_URLLOADER_SUBTESTS_1;
477 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, URLLoader2) {
478 RUN_URLLOADER_SUBTESTS_2;
480 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, URLLoader3) {
481 RUN_URLLOADER_SUBTESTS_3;
483 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, URLLoaderTrusted) {
484 RUN_URLLOADER_TRUSTED_SUBTESTS;
486 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, URLLoader0) {
487 RUN_URLLOADER_SUBTESTS_0;
489 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, URLLoader1) {
490 RUN_URLLOADER_SUBTESTS_1;
492 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, URLLoader2) {
493 RUN_URLLOADER_SUBTESTS_2;
495 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, URLLoader3) {
496 RUN_URLLOADER_SUBTESTS_3;
499 // Flaky on 32-bit linux bot; http://crbug.com/308906
500 #if defined(OS_LINUX) && defined(ARCH_CPU_X86)
501 #define MAYBE_URLLoader_BasicFilePOST DISABLED_URLLoader_BasicFilePOST
502 #else
503 #define MAYBE_URLLoader_BasicFilePOST URLLoader_BasicFilePOST
504 #endif
505 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(URLLoader0)) {
506 RunTestViaHTTP(
507 LIST_TEST(URLLoader_BasicGET)
508 LIST_TEST(URLLoader_BasicPOST)
509 LIST_TEST(MAYBE_URLLoader_BasicFilePOST)
510 LIST_TEST(URLLoader_BasicFileRangePOST)
511 LIST_TEST(URLLoader_CompoundBodyPOST)
515 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(URLLoader1)) {
516 RUN_URLLOADER_SUBTESTS_1;
518 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(URLLoader2)) {
519 RUN_URLLOADER_SUBTESTS_2;
521 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(URLLoader3)) {
522 RUN_URLLOADER_SUBTESTS_3;
524 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, URLLoader0) {
525 RUN_URLLOADER_SUBTESTS_0;
527 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, URLLoader1) {
528 RUN_URLLOADER_SUBTESTS_1;
530 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, URLLoader2) {
531 RUN_URLLOADER_SUBTESTS_2;
533 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, URLLoader3) {
534 RUN_URLLOADER_SUBTESTS_3;
536 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
537 MAYBE_PNACL_NONSFI(URLLoader0)) {
538 RUN_URLLOADER_SUBTESTS_0;
540 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
541 MAYBE_PNACL_NONSFI(URLLoader1)) {
542 RUN_URLLOADER_SUBTESTS_1;
544 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
545 MAYBE_PNACL_NONSFI(URLLoader2)) {
546 RUN_URLLOADER_SUBTESTS_2;
548 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
549 MAYBE_PNACL_NONSFI(URLLoader3)) {
550 RUN_URLLOADER_SUBTESTS_3;
553 // URLRequestInfo tests.
554 TEST_PPAPI_IN_PROCESS_VIA_HTTP(URLRequest_CreateAndIsURLRequestInfo)
555 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(URLRequest_CreateAndIsURLRequestInfo)
557 // Timing out on Windows. http://crbug.com/129571
558 #if defined(OS_WIN)
559 #define MAYBE_URLRequest_CreateAndIsURLRequestInfo \
560 DISABLED_URLRequest_CreateAndIsURLRequestInfo
561 #else
562 #define MAYBE_URLRequest_CreateAndIsURLRequestInfo \
563 URLRequest_CreateAndIsURLRequestInfo
564 #endif
565 TEST_PPAPI_NACL(MAYBE_URLRequest_CreateAndIsURLRequestInfo)
567 TEST_PPAPI_IN_PROCESS_VIA_HTTP(URLRequest_SetProperty)
568 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(URLRequest_SetProperty)
569 TEST_PPAPI_NACL(URLRequest_SetProperty)
570 TEST_PPAPI_IN_PROCESS_VIA_HTTP(URLRequest_AppendDataToBody)
571 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(URLRequest_AppendDataToBody)
572 TEST_PPAPI_NACL(URLRequest_AppendDataToBody)
573 TEST_PPAPI_IN_PROCESS_VIA_HTTP(DISABLED_URLRequest_AppendFileToBody)
574 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(DISABLED_URLRequest_AppendFileToBody)
575 TEST_PPAPI_NACL(DISABLED_URLRequest_AppendFileToBody)
576 TEST_PPAPI_IN_PROCESS_VIA_HTTP(URLRequest_Stress)
577 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(URLRequest_Stress)
578 TEST_PPAPI_NACL(URLRequest_Stress)
580 TEST_PPAPI_IN_PROCESS(PaintAggregator)
581 TEST_PPAPI_OUT_OF_PROCESS(PaintAggregator)
582 TEST_PPAPI_NACL(PaintAggregator)
584 // TODO(danakj): http://crbug.com/115286
585 TEST_PPAPI_NACL(DISABLED_Scrollbar)
587 TEST_PPAPI_NACL(Var)
589 TEST_PPAPI_NACL(VarResource)
591 // PostMessage tests.
592 #define RUN_POSTMESSAGE_SUBTESTS \
593 RunTestViaHTTP( \
594 LIST_TEST(PostMessage_SendInInit) \
595 LIST_TEST(PostMessage_SendingData) \
596 LIST_TEST(PostMessage_SendingString) \
597 LIST_TEST(PostMessage_SendingArrayBuffer) \
598 LIST_TEST(PostMessage_SendingArray) \
599 LIST_TEST(PostMessage_SendingDictionary) \
600 LIST_TEST(PostMessage_SendingResource) \
601 LIST_TEST(PostMessage_SendingComplexVar) \
602 LIST_TEST(PostMessage_MessageEvent) \
603 LIST_TEST(PostMessage_NoHandler) \
604 LIST_TEST(PostMessage_ExtraParam) \
605 LIST_TEST(PostMessage_NonMainThread) \
608 // Windows defines 'PostMessage', so we have to undef it.
609 #ifdef PostMessage
610 #undef PostMessage
611 #endif
613 #if defined(OS_WIN)
614 // http://crbug.com/95557
615 #define MAYBE_PostMessage DISABLED_PostMessage
616 #else
617 #define MAYBE_PostMessage PostMessage
618 #endif
619 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, MAYBE_PostMessage) {
620 RUN_POSTMESSAGE_SUBTESTS;
622 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, PostMessage) {
623 RUN_POSTMESSAGE_SUBTESTS;
625 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(PostMessage)) {
626 RUN_POSTMESSAGE_SUBTESTS;
628 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, PostMessage) {
629 RUN_POSTMESSAGE_SUBTESTS;
631 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
632 MAYBE_PNACL_NONSFI(PostMessage)) {
633 RUN_POSTMESSAGE_SUBTESTS;
636 TEST_PPAPI_NACL(Memory)
638 // FileIO tests.
639 #define RUN_FILEIO_SUBTESTS \
640 RunTestViaHTTP( \
641 LIST_TEST(FileIO_Open) \
642 LIST_TEST(FileIO_OpenDirectory) \
643 LIST_TEST(FileIO_AbortCalls) \
644 LIST_TEST(FileIO_ParallelReads) \
645 LIST_TEST(FileIO_ParallelWrites) \
646 LIST_TEST(FileIO_NotAllowMixedReadWrite) \
647 LIST_TEST(FileIO_ReadWriteSetLength) \
648 LIST_TEST(FileIO_ReadToArrayWriteSetLength) \
649 LIST_TEST(FileIO_TouchQuery) \
652 #define RUN_FILEIO_PRIVATE_SUBTESTS \
653 RunTestViaHTTP( \
654 LIST_TEST(FileIO_RequestOSFileHandle) \
655 LIST_TEST(FileIO_RequestOSFileHandleWithOpenExclusive) \
656 LIST_TEST(FileIO_Mmap) \
659 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA)
660 // TODO(erg): linux_aura bringup: http://crbug.com/318961
661 #define MAYBE_FileIO DISABLED_FileIO
662 #define MAYBE_FileIO_Private DISABLED_FileIO_Private
663 #else
664 #define MAYBE_FileIO FileIO
665 #define MAYBE_FileIO_Private FileIO_Private
666 #endif
668 IN_PROC_BROWSER_TEST_F(PPAPITest, MAYBE_FileIO) {
669 RUN_FILEIO_SUBTESTS;
671 IN_PROC_BROWSER_TEST_F(PPAPIPrivateTest, MAYBE_FileIO_Private) {
672 RUN_FILEIO_PRIVATE_SUBTESTS;
675 // See: crbug.com/421284
676 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, DISABLED_FileIO) {
677 RUN_FILEIO_SUBTESTS;
679 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPIPrivateTest, MAYBE_FileIO_Private) {
680 RUN_FILEIO_PRIVATE_SUBTESTS;
683 // http://crbug.com/313401
684 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, DISABLED_FileIO) {
685 RUN_FILEIO_SUBTESTS;
687 // http://crbug.com/313401
688 IN_PROC_BROWSER_TEST_F(PPAPIPrivateNaClNewlibTest,
689 DISABLED_NaCl_Newlib_FileIO_Private) {
690 RUN_FILEIO_PRIVATE_SUBTESTS;
693 // Flaky on 32-bit linux bot; http://crbug.com/308905
694 // Flaky on Windows too; http://crbug.com/321300
695 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, DISABLED_FileIO) {
696 RUN_FILEIO_SUBTESTS;
698 IN_PROC_BROWSER_TEST_F(PPAPIPrivateNaClGLibcTest, DISABLED_FileIO_Private) {
699 RUN_FILEIO_PRIVATE_SUBTESTS;
702 // http://crbug.com/313205
703 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, DISABLED_FileIO) {
704 RUN_FILEIO_SUBTESTS;
706 IN_PROC_BROWSER_TEST_F(PPAPIPrivateNaClPNaClTest,
707 DISABLED_PNaCl_FileIO_Private) {
708 RUN_FILEIO_PRIVATE_SUBTESTS;
711 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest, MAYBE_PNACL_NONSFI(FileIO)) {
712 RUN_FILEIO_SUBTESTS;
714 IN_PROC_BROWSER_TEST_F(PPAPIPrivateNaClPNaClTest,
715 MAYBE_PNACL_NONSFI(FILEIO_Private)) {
716 RUN_FILEIO_PRIVATE_SUBTESTS;
719 // PPB_FileMapping is only implemented on POSIX currently.
720 // http://crbug.com/83774
721 #if defined(OS_WIN)
722 #define MAYBE_FileMapping DISABLED_FileMapping
723 #else
724 #define MAYBE_FileMapping FileMapping
725 #endif
726 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(MAYBE_FileMapping)
727 TEST_PPAPI_NACL(MAYBE_FileMapping)
729 // FileRef tests.
730 #define RUN_FILEREF_SUBTESTS_1 \
731 RunTestViaHTTP( \
732 LIST_TEST(FileRef_Create) \
733 LIST_TEST(FileRef_GetFileSystemType) \
734 LIST_TEST(FileRef_GetName) \
735 LIST_TEST(FileRef_GetPath) \
736 LIST_TEST(FileRef_GetParent) \
737 LIST_TEST(FileRef_MakeDirectory) \
740 #define RUN_FILEREF_SUBTESTS_2 \
741 RunTestViaHTTP( \
742 LIST_TEST(FileRef_QueryAndTouchFile) \
743 LIST_TEST(FileRef_DeleteFileAndDirectory) \
744 LIST_TEST(FileRef_RenameFileAndDirectory) \
745 LIST_TEST(FileRef_Query) \
746 LIST_TEST(FileRef_FileNameEscaping) \
749 // Note, the FileRef tests are split into two, because all of them together
750 // sometimes take too long on windows: crbug.com/336999
751 IN_PROC_BROWSER_TEST_F(PPAPITest, FileRef1) {
752 RUN_FILEREF_SUBTESTS_1;
754 IN_PROC_BROWSER_TEST_F(PPAPITest, FileRef2) {
755 RUN_FILEREF_SUBTESTS_2;
757 // This test only works as an in-process test. See crbug.com/241646.
758 IN_PROC_BROWSER_TEST_F(PPAPITest, FileRef_ReadDirectoryEntries) {
759 RunTestViaHTTP(LIST_TEST(FileRef_ReadDirectoryEntries));
761 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, FileRef1) {
762 RUN_FILEREF_SUBTESTS_1;
764 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, FileRef2) {
765 RUN_FILEREF_SUBTESTS_2;
767 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, FileRef1) {
768 RUN_FILEREF_SUBTESTS_1;
770 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, FileRef2) {
771 RUN_FILEREF_SUBTESTS_2;
773 // Flaky on 32-bit linux bot; http://crbug.com/308908
774 // Glibc not available on ARM
775 #if (defined(OS_LINUX) && defined(ARCH_CPU_X86)) \
776 || defined(ARCH_CPU_ARM_FAMILY)
777 #define MAYBE_NaCl_Glibc_FileRef1 DISABLED_FileRef1
778 #define MAYBE_NaCl_Glibc_FileRef2 DISABLED_FileRef2
779 #else
780 #define MAYBE_NaCl_Glibc_FileRef1 FileRef1
781 #define MAYBE_NaCl_Glibc_FileRef2 FileRef2
782 #endif
783 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_NaCl_Glibc_FileRef1) {
784 RUN_FILEREF_SUBTESTS_1;
786 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_NaCl_Glibc_FileRef2) {
787 RUN_FILEREF_SUBTESTS_2;
789 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, FileRef1) {
790 RUN_FILEREF_SUBTESTS_1;
792 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, FileRef2) {
793 RUN_FILEREF_SUBTESTS_2;
795 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
796 MAYBE_PNACL_NONSFI(FileRef1)) {
797 RUN_FILEREF_SUBTESTS_1;
799 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
800 MAYBE_PNACL_NONSFI(FileRef2)) {
801 RUN_FILEREF_SUBTESTS_2;
804 TEST_PPAPI_IN_PROCESS_VIA_HTTP(FileSystem)
805 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(FileSystem)
807 // PPAPINaClTest.FileSystem times out consistently on Windows and Mac.
808 // http://crbug.com/130372
809 #if defined(OS_MACOSX) || defined(OS_WIN)
810 #define MAYBE_FileSystem DISABLED_FileSystem
811 #else
812 #define MAYBE_FileSystem FileSystem
813 #endif
815 TEST_PPAPI_NACL(MAYBE_FileSystem)
817 #if defined(OS_MACOSX)
818 // http://crbug.com/103912
819 #define MAYBE_Fullscreen DISABLED_Fullscreen
820 #elif defined(OS_LINUX)
821 // http://crbug.com/146008
822 #define MAYBE_Fullscreen DISABLED_Fullscreen
823 #elif defined(OS_WIN)
824 // http://crbug.com/342269
825 #define MAYBE_Fullscreen DISABLED_Fullscreen
826 #else
827 #define MAYBE_Fullscreen Fullscreen
828 #endif
830 TEST_PPAPI_IN_PROCESS_VIA_HTTP(MAYBE_Fullscreen)
831 TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(MAYBE_Fullscreen)
832 TEST_PPAPI_NACL(MAYBE_Fullscreen)
834 TEST_PPAPI_OUT_OF_PROCESS(X509CertificatePrivate)
836 TEST_PPAPI_IN_PROCESS(UMA)
837 TEST_PPAPI_OUT_OF_PROCESS(UMA)
838 TEST_PPAPI_NACL(UMA)
840 // NetAddress tests.
841 #define RUN_NETADDRESS_SUBTESTS \
842 RunTestViaHTTP( \
843 LIST_TEST(NetAddress_IPv4Address) \
844 LIST_TEST(NetAddress_IPv6Address) \
845 LIST_TEST(NetAddress_DescribeAsString) \
848 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, NetAddress) {
849 RUN_NETADDRESS_SUBTESTS;
851 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, NetAddress) {
852 RUN_NETADDRESS_SUBTESTS;
854 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(NetAddress)) {
855 RUN_NETADDRESS_SUBTESTS;
857 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, NetAddress) {
858 RUN_NETADDRESS_SUBTESTS;
860 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
861 MAYBE_PNACL_NONSFI(NetAddress)) {
862 RUN_NETADDRESS_SUBTESTS;
865 // NetAddressPrivate tests.
866 #define RUN_NETADDRESS_PRIVATE_SUBTESTS \
867 RunTestViaHTTP( \
868 LIST_TEST(NetAddressPrivate_AreEqual) \
869 LIST_TEST(NetAddressPrivate_AreHostsEqual) \
870 LIST_TEST(NetAddressPrivate_Describe) \
871 LIST_TEST(NetAddressPrivate_ReplacePort) \
872 LIST_TEST(NetAddressPrivate_GetAnyAddress) \
873 LIST_TEST(NetAddressPrivate_DescribeIPv6) \
874 LIST_TEST(NetAddressPrivate_GetFamily) \
875 LIST_TEST(NetAddressPrivate_GetPort) \
876 LIST_TEST(NetAddressPrivate_GetAddress) \
877 LIST_TEST(NetAddressPrivate_GetScopeID) \
880 IN_PROC_BROWSER_TEST_F(PPAPITest, NetAddressPrivate) {
881 RUN_NETADDRESS_PRIVATE_SUBTESTS;
883 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, NetAddressPrivate) {
884 RUN_NETADDRESS_PRIVATE_SUBTESTS;
887 #define RUN_NETADDRESS_PRIVATE_UNTRUSTED_SUBTESTS \
888 RunTestViaHTTP( \
889 LIST_TEST(NetAddressPrivateUntrusted_AreEqual) \
890 LIST_TEST(NetAddressPrivateUntrusted_AreHostsEqual) \
891 LIST_TEST(NetAddressPrivateUntrusted_Describe) \
892 LIST_TEST(NetAddressPrivateUntrusted_ReplacePort) \
893 LIST_TEST(NetAddressPrivateUntrusted_GetAnyAddress) \
894 LIST_TEST(NetAddressPrivateUntrusted_GetFamily) \
895 LIST_TEST(NetAddressPrivateUntrusted_GetPort) \
896 LIST_TEST(NetAddressPrivateUntrusted_GetAddress) \
899 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, NetAddressPrivate) {
900 RUN_NETADDRESS_PRIVATE_UNTRUSTED_SUBTESTS;
902 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(NetAddressPrivate)) {
903 RUN_NETADDRESS_PRIVATE_UNTRUSTED_SUBTESTS;
905 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, NetAddressPrivate) {
906 RUN_NETADDRESS_PRIVATE_UNTRUSTED_SUBTESTS;
908 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
909 MAYBE_PNACL_NONSFI(NetAddressPrivate)) {
910 RUN_NETADDRESS_PRIVATE_UNTRUSTED_SUBTESTS;
913 // NetworkMonitor tests.
914 #define RUN_NETWORK_MONITOR_SUBTESTS \
915 RunTestViaHTTP( \
916 LIST_TEST(NetworkMonitor_Basic) \
917 LIST_TEST(NetworkMonitor_2Monitors) \
918 LIST_TEST(NetworkMonitor_DeleteInCallback) \
921 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, NetworkMonitor) {
922 RUN_NETWORK_MONITOR_SUBTESTS;
924 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, NetworkMonitor) {
925 RUN_NETWORK_MONITOR_SUBTESTS;
927 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(NetworkMonitor)) {
928 RUN_NETWORK_MONITOR_SUBTESTS;
930 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, NetworkMonitor) {
931 RUN_NETWORK_MONITOR_SUBTESTS;
933 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
934 MAYBE_PNACL_NONSFI(NetworkMonitor)) {
935 RUN_NETWORK_MONITOR_SUBTESTS;
938 // Flash tests.
939 #define RUN_FLASH_SUBTESTS \
940 RunTestViaHTTP( \
941 LIST_TEST(Flash_SetInstanceAlwaysOnTop) \
942 LIST_TEST(Flash_GetCommandLineArgs) \
945 IN_PROC_BROWSER_TEST_F(PPAPITest, Flash) {
946 RUN_FLASH_SUBTESTS;
948 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, Flash) {
949 RUN_FLASH_SUBTESTS;
952 // In-process WebSocket tests. Note, the WebSocket tests are split into two,
953 // because all of them together sometimes take too long on windows:
954 // crbug.com/336999
955 #define RUN_WEBSOCKET_SUBTESTS_1 \
956 RunTestWithWebSocketServer( \
957 LIST_TEST(WebSocket_IsWebSocket) \
958 LIST_TEST(WebSocket_UninitializedPropertiesAccess) \
959 LIST_TEST(WebSocket_InvalidConnect) \
960 LIST_TEST(WebSocket_Protocols) \
961 LIST_TEST(WebSocket_GetURL) \
962 LIST_TEST(WebSocket_ValidConnect) \
963 LIST_TEST(WebSocket_InvalidClose) \
964 LIST_TEST(WebSocket_ValidClose) \
965 LIST_TEST(WebSocket_GetProtocol) \
966 LIST_TEST(WebSocket_TextSendReceive) \
967 LIST_TEST(WebSocket_BinarySendReceive) \
968 LIST_TEST(WebSocket_StressedSendReceive) \
969 LIST_TEST(WebSocket_BufferedAmount) \
972 #define RUN_WEBSOCKET_SUBTESTS_2 \
973 RunTestWithWebSocketServer( \
974 LIST_TEST(WebSocket_AbortCallsWithCallback) \
975 LIST_TEST(WebSocket_AbortSendMessageCall) \
976 LIST_TEST(WebSocket_AbortCloseCall) \
977 LIST_TEST(WebSocket_AbortReceiveMessageCall) \
978 LIST_TEST(WebSocket_ClosedFromServerWhileSending) \
979 LIST_TEST(WebSocket_CcInterfaces) \
980 LIST_TEST(WebSocket_UtilityInvalidConnect) \
981 LIST_TEST(WebSocket_UtilityProtocols) \
982 LIST_TEST(WebSocket_UtilityGetURL) \
983 LIST_TEST(WebSocket_UtilityValidConnect) \
984 LIST_TEST(WebSocket_UtilityInvalidClose) \
985 LIST_TEST(WebSocket_UtilityValidClose) \
986 LIST_TEST(WebSocket_UtilityGetProtocol) \
987 LIST_TEST(WebSocket_UtilityTextSendReceive) \
988 LIST_TEST(WebSocket_UtilityBinarySendReceive) \
989 LIST_TEST(WebSocket_UtilityBufferedAmount) \
992 IN_PROC_BROWSER_TEST_F(PPAPITest, WebSocket1) {
993 RUN_WEBSOCKET_SUBTESTS_1;
995 IN_PROC_BROWSER_TEST_F(PPAPITest, WebSocket2) {
996 RUN_WEBSOCKET_SUBTESTS_2;
998 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, WebSocket1) {
999 RUN_WEBSOCKET_SUBTESTS_1;
1001 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, WebSocket2) {
1002 RUN_WEBSOCKET_SUBTESTS_2;
1004 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(WebSocket1)) {
1005 RUN_WEBSOCKET_SUBTESTS_1;
1007 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(WebSocket2)) {
1008 RUN_WEBSOCKET_SUBTESTS_2;
1010 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, WebSocket1) {
1011 RUN_WEBSOCKET_SUBTESTS_1;
1013 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, WebSocket2) {
1014 RUN_WEBSOCKET_SUBTESTS_2;
1016 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, WebSocket1) {
1017 RUN_WEBSOCKET_SUBTESTS_1;
1019 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, WebSocket2) {
1020 RUN_WEBSOCKET_SUBTESTS_2;
1022 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
1023 MAYBE_PNACL_NONSFI(WebSocket1)) {
1024 RUN_WEBSOCKET_SUBTESTS_1;
1026 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
1027 MAYBE_PNACL_NONSFI(WebSocket2)) {
1028 RUN_WEBSOCKET_SUBTESTS_2;
1031 // AudioConfig tests
1032 #define RUN_AUDIO_CONFIG_SUBTESTS \
1033 RunTestViaHTTP( \
1034 LIST_TEST(AudioConfig_RecommendSampleRate) \
1035 LIST_TEST(AudioConfig_ValidConfigs) \
1036 LIST_TEST(AudioConfig_InvalidConfigs) \
1039 IN_PROC_BROWSER_TEST_F(PPAPITest, AudioConfig) {
1040 RUN_AUDIO_CONFIG_SUBTESTS;
1042 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, AudioConfig) {
1043 RUN_AUDIO_CONFIG_SUBTESTS;
1045 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, AudioConfig) {
1046 RUN_AUDIO_CONFIG_SUBTESTS;
1048 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(AudioConfig)) {
1049 RUN_AUDIO_CONFIG_SUBTESTS;
1051 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, AudioConfig) {
1052 RUN_AUDIO_CONFIG_SUBTESTS;
1054 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
1055 MAYBE_PNACL_NONSFI(AudioConfig)) {
1056 RUN_AUDIO_CONFIG_SUBTESTS;
1059 // PPB_Audio tests.
1060 #define RUN_AUDIO_SUBTESTS \
1061 RunTestViaHTTP( \
1062 LIST_TEST(Audio_Creation) \
1063 LIST_TEST(Audio_DestroyNoStop) \
1064 LIST_TEST(Audio_Failures) \
1065 LIST_TEST(Audio_AudioCallback1) \
1066 LIST_TEST(Audio_AudioCallback2) \
1067 LIST_TEST(Audio_AudioCallback3) \
1068 LIST_TEST(Audio_AudioCallback4) \
1071 #if defined(OS_LINUX)
1072 // http://crbug.com/396464
1073 #define MAYBE_Audio DISABLED_Audio
1074 #else
1075 #define MAYBE_Audio Audio
1076 #endif
1077 // PPB_Audio is not supported in-process.
1078 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, MAYBE_Audio) {
1079 RUN_AUDIO_SUBTESTS;
1081 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, Audio) {
1082 RUN_AUDIO_SUBTESTS;
1084 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(Audio)) {
1085 RUN_AUDIO_SUBTESTS;
1087 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, Audio) {
1088 RUN_AUDIO_SUBTESTS;
1090 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
1091 MAYBE_PNACL_NONSFI(Audio)) {
1092 RUN_AUDIO_SUBTESTS;
1095 #define RUN_AUDIO_THREAD_CREATOR_SUBTESTS \
1096 RunTestViaHTTP( \
1097 LIST_TEST(Audio_AudioThreadCreatorIsRequired) \
1098 LIST_TEST(Audio_AudioThreadCreatorIsCalled) \
1101 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, AudioThreadCreator) {
1102 RUN_AUDIO_THREAD_CREATOR_SUBTESTS;
1104 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(AudioThreadCreator)) {
1105 RUN_AUDIO_THREAD_CREATOR_SUBTESTS;
1107 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, AudioThreadCreator) {
1108 RUN_AUDIO_THREAD_CREATOR_SUBTESTS;
1110 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest,
1111 MAYBE_PNACL_NONSFI(AudioThreadCreator)) {
1112 RUN_AUDIO_THREAD_CREATOR_SUBTESTS;
1115 TEST_PPAPI_IN_PROCESS(View_CreatedVisible);
1116 TEST_PPAPI_OUT_OF_PROCESS(View_CreatedVisible);
1117 TEST_PPAPI_NACL(View_CreatedVisible);
1118 // This test ensures that plugins created in a background tab have their
1119 // initial visibility set to false. We don't bother testing in-process for this
1120 // custom test since the out of process code also exercises in-process.
1122 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, View_CreateInvisible) {
1123 // Make a second tab in the foreground.
1124 GURL url = GetTestFileUrl("View_CreatedInvisible");
1125 chrome::NavigateParams params(browser(), url, ui::PAGE_TRANSITION_LINK);
1126 params.disposition = NEW_BACKGROUND_TAB;
1127 ui_test_utils::NavigateToURL(&params);
1130 // This test messes with tab visibility so is custom.
1131 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, DISABLED_View_PageHideShow) {
1132 // The plugin will be loaded in the foreground tab and will send us a message.
1133 PPAPITestMessageHandler handler;
1134 content::JavascriptTestObserver observer(
1135 browser()->tab_strip_model()->GetActiveWebContents(),
1136 &handler);
1138 GURL url = GetTestFileUrl("View_PageHideShow");
1139 ui_test_utils::NavigateToURL(browser(), url);
1141 ASSERT_TRUE(observer.Run()) << handler.error_message();
1142 EXPECT_STREQ("TestPageHideShow:Created", handler.message().c_str());
1143 observer.Reset();
1145 // Make a new tab to cause the original one to hide, this should trigger the
1146 // next phase of the test.
1147 chrome::NavigateParams params(
1148 browser(), GURL(url::kAboutBlankURL), ui::PAGE_TRANSITION_LINK);
1149 params.disposition = NEW_FOREGROUND_TAB;
1150 ui_test_utils::NavigateToURL(&params);
1152 // Wait until the test acks that it got hidden.
1153 ASSERT_TRUE(observer.Run()) << handler.error_message();
1154 EXPECT_STREQ("TestPageHideShow:Hidden", handler.message().c_str());
1155 observer.Reset();
1157 // Switch back to the test tab.
1158 browser()->tab_strip_model()->ActivateTabAt(0, true);
1160 ASSERT_TRUE(observer.Run()) << handler.error_message();
1161 EXPECT_STREQ("PASS", handler.message().c_str());
1164 // Tests that if a plugin accepts touch events, the browser knows to send touch
1165 // events to the renderer.
1166 IN_PROC_BROWSER_TEST_F(PPAPITest, InputEvent_AcceptTouchEvent) {
1167 std::string positive_tests[] = { "InputEvent_AcceptTouchEvent_1",
1168 "InputEvent_AcceptTouchEvent_2",
1169 "InputEvent_AcceptTouchEvent_3",
1170 "InputEvent_AcceptTouchEvent_4"
1173 for (size_t i = 0; i < arraysize(positive_tests); ++i) {
1174 RenderViewHost* host = browser()->tab_strip_model()->
1175 GetActiveWebContents()->GetRenderViewHost();
1176 RunTest(positive_tests[i]);
1177 EXPECT_TRUE(content::RenderViewHostTester::HasTouchEventHandler(host));
1181 // View tests.
1182 #define RUN_VIEW_SUBTESTS \
1183 RunTestViaHTTP( \
1184 LIST_TEST(View_SizeChange) \
1185 LIST_TEST(View_ClipChange) \
1186 LIST_TEST(View_ScrollOffsetChange) \
1189 IN_PROC_BROWSER_TEST_F(PPAPITest, View) {
1190 RUN_VIEW_SUBTESTS;
1192 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, View) {
1193 RUN_VIEW_SUBTESTS;
1195 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, View) {
1196 RUN_VIEW_SUBTESTS;
1198 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, MAYBE_GLIBC(View)) {
1199 RUN_VIEW_SUBTESTS;
1201 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, View) {
1202 RUN_VIEW_SUBTESTS;
1204 IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClNonSfiTest, MAYBE_PNACL_NONSFI(View)) {
1205 RUN_VIEW_SUBTESTS;
1208 // FlashMessageLoop tests.
1209 #define RUN_FLASH_MESSAGE_LOOP_SUBTESTS \
1210 RunTest( \
1211 LIST_TEST(FlashMessageLoop_Basics) \
1212 LIST_TEST(FlashMessageLoop_RunWithoutQuit) \
1215 IN_PROC_BROWSER_TEST_F(PPAPITest, FlashMessageLoop) {
1216 RUN_FLASH_MESSAGE_LOOP_SUBTESTS;
1218 #if defined(OS_LINUX) // Disabled due to flakiness http://crbug.com/316925
1219 #define MAYBE_FlashMessageLoop DISABLED_FlashMessageLoop
1220 #else
1221 #define MAYBE_FlashMessageLoop FlashMessageLoop
1222 #endif
1223 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, MAYBE_FlashMessageLoop) {
1224 RUN_FLASH_MESSAGE_LOOP_SUBTESTS;
1227 // The compositor test timeouts sometimes, so we have to split it to two
1228 // subtests.
1229 #define RUN_COMPOSITOR_SUBTESTS_0 \
1230 RunTestViaHTTP( \
1231 LIST_TEST(Compositor_BindUnbind) \
1232 LIST_TEST(Compositor_Release) \
1233 LIST_TEST(Compositor_ReleaseUnbound) \
1234 LIST_TEST(Compositor_ReleaseWithoutCommit) \
1235 LIST_TEST(Compositor_ReleaseWithoutCommitUnbound) \
1238 #define RUN_COMPOSITOR_SUBTESTS_1 \
1239 RunTestViaHTTP( \
1240 LIST_TEST(Compositor_CommitTwoTimesWithoutChange) \
1241 LIST_TEST(Compositor_CommitTwoTimesWithoutChangeUnbound) \
1242 LIST_TEST(Compositor_General) \
1243 LIST_TEST(Compositor_GeneralUnbound) \
1246 #if defined(OS_WIN)
1247 // This test fails with the test compositor which is what's used by default for
1248 // browser tests on Windows. Renable when the software compositor is available.
1249 #define MAYBE_Compositor0 DISABLED_Compositor0
1250 #define MAYBE_Compositor1 DISABLED_Compositor1
1251 #elif defined(OS_MACOSX)
1252 // This test fails when using the legacy software mode. Reenable when the
1253 // software compositor is enabled crbug.com/286038
1254 #define MAYBE_Compositor0 DISABLED_Compositor0
1255 #define MAYBE_Compositor1 DISABLED_Compositor1
1256 #else
1257 // flaky on Linux: http://crbug.com/396482
1258 #define MAYBE_Compositor0 DISABLED_Compositor0
1259 #define MAYBE_Compositor1 DISABLED_Compositor1
1260 #endif
1262 TEST_PPAPI_NACL_SUBTESTS(MAYBE_Compositor0, RUN_COMPOSITOR_SUBTESTS_0)
1263 TEST_PPAPI_NACL_SUBTESTS(MAYBE_Compositor1, RUN_COMPOSITOR_SUBTESTS_1)
1265 TEST_PPAPI_NACL(MediaStreamAudioTrack)
1267 TEST_PPAPI_NACL(MediaStreamVideoTrack)
1269 TEST_PPAPI_NACL(MouseCursor)
1271 TEST_PPAPI_NACL(NetworkProxy)
1273 TEST_PPAPI_NACL(TrueTypeFont)
1275 TEST_PPAPI_NACL(VideoDecoder)
1277 // VideoDestination doesn't work in content_browsertests.
1278 TEST_PPAPI_OUT_OF_PROCESS(VideoDestination)
1279 TEST_PPAPI_NACL(VideoDestination)
1281 // VideoSource doesn't work in content_browsertests.
1282 TEST_PPAPI_OUT_OF_PROCESS(VideoSource)
1283 TEST_PPAPI_NACL(VideoSource)
1285 // Printing doesn't work in content_browsertests.
1286 TEST_PPAPI_OUT_OF_PROCESS(Printing)
1288 TEST_PPAPI_NACL(MessageHandler)
1290 TEST_PPAPI_NACL(MessageLoop_Basics)
1291 TEST_PPAPI_NACL(MessageLoop_Post)
1293 // Going forward, Flash APIs will only work out-of-process.
1294 TEST_PPAPI_OUT_OF_PROCESS(Flash_GetLocalTimeZoneOffset)
1295 TEST_PPAPI_OUT_OF_PROCESS(Flash_GetProxyForURL)
1296 TEST_PPAPI_OUT_OF_PROCESS(Flash_GetSetting)
1297 TEST_PPAPI_OUT_OF_PROCESS(Flash_SetCrashData)
1298 // http://crbug.com/176822
1299 #if !defined(OS_WIN)
1300 TEST_PPAPI_OUT_OF_PROCESS(FlashClipboard)
1301 #endif
1302 TEST_PPAPI_OUT_OF_PROCESS(FlashFile)
1303 // Mac/Aura reach NOTIMPLEMENTED/time out.
1304 // mac: http://crbug.com/96767
1305 // aura: http://crbug.com/104384
1306 // cros: http://crbug.com/396502
1307 #if defined(OS_MACOSX) || defined(OS_CHROMEOS)
1308 #define MAYBE_FlashFullscreen DISABLED_FlashFullscreen
1309 #else
1310 #define MAYBE_FlashFullscreen FlashFullscreen
1311 #endif
1312 TEST_PPAPI_OUT_OF_PROCESS(MAYBE_FlashFullscreen)
1314 TEST_PPAPI_OUT_OF_PROCESS(PDF)
1316 // TODO(dalecurtis): Renable once the platform verification infobar has been
1317 // implemented; see http://crbug.com/270908
1318 // #if defined(OS_CHROMEOS)
1319 // TEST_PPAPI_OUT_OF_PROCESS(PlatformVerificationPrivate)
1320 // #endif
1322 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, FlashDRM) {
1323 RunTest(
1324 #if (defined(OS_WIN) && defined(ENABLE_RLZ)) || defined(OS_CHROMEOS)
1325 // Only implemented on Windows and ChromeOS currently.
1326 LIST_TEST(FlashDRM_GetDeviceID)
1327 #endif
1328 LIST_TEST(FlashDRM_GetHmonitor)
1329 LIST_TEST(FlashDRM_GetVoucherFile));
1332 TEST_PPAPI_IN_PROCESS(TalkPrivate)
1333 TEST_PPAPI_OUT_OF_PROCESS(TalkPrivate)
1335 #if defined(OS_CHROMEOS)
1336 TEST_PPAPI_OUT_OF_PROCESS(OutputProtectionPrivate)
1337 #endif
1339 class PackagedAppTest : public ExtensionBrowserTest {
1340 public:
1341 virtual void SetUpOnMainThread() override {
1344 void LaunchTestingApp() {
1345 base::FilePath data_dir;
1346 ASSERT_TRUE(PathService::Get(chrome::DIR_GEN_TEST_DATA, &data_dir));
1347 base::FilePath app_dir = data_dir.AppendASCII("ppapi")
1348 .AppendASCII("tests")
1349 .AppendASCII("extensions")
1350 .AppendASCII("packaged_app")
1351 .AppendASCII("newlib");
1353 const extensions::Extension* extension = LoadExtension(app_dir);
1354 ASSERT_TRUE(extension);
1356 AppLaunchParams params(browser()->profile(),
1357 extension,
1358 extensions::LAUNCH_CONTAINER_NONE,
1359 NEW_WINDOW);
1360 params.command_line = *CommandLine::ForCurrentProcess();
1361 OpenApplication(params);
1365 // Load a packaged app, and wait for it to successfully post a "hello" message
1366 // back.
1367 IN_PROC_BROWSER_TEST_F(PackagedAppTest, SuccessfulLoad) {
1368 ExtensionTestMessageListener listener("hello", true);
1369 LaunchTestingApp();
1370 EXPECT_TRUE(listener.WaitUntilSatisfied());