1 // Copyright 2014 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 "content/test/ppapi/ppapi_test.h"
6 #include "ppapi/shared_impl/test_utils.h"
8 // This file lists tests for Pepper APIs (without NaCl) against content_shell.
9 // TODO(teravest): Move more tests here. http://crbug.com/371873
11 // See chrome/test/ppapi/ppapi_browsertests.cc for Pepper testing that's
12 // covered in browser_tests.
17 // This macro finesses macro expansion to do what we want.
18 #define STRIP_PREFIXES(test_name) ppapi::StripTestPrefixes(#test_name)
20 #if defined(THREAD_SANITIZER)
21 #define DISABLE_IF_TSAN(test_name) DISABLED_##test_name
23 #define DISABLE_IF_TSAN(test_name) test_name
26 #define TEST_PPAPI_IN_PROCESS(test_name) \
27 IN_PROC_BROWSER_TEST_F(PPAPITest, test_name) { \
28 RunTest(STRIP_PREFIXES(test_name)); \
31 // OutOfProcessPPAPITest tests time out under ThreadSanitizer,
32 // see https://crbug.com/448323.
33 #define TEST_PPAPI_OUT_OF_PROCESS(test_name) \
34 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, DISABLE_IF_TSAN(test_name)) { \
35 RunTest(STRIP_PREFIXES(test_name)); \
38 TEST_PPAPI_OUT_OF_PROCESS(BrowserFont
)
40 TEST_PPAPI_IN_PROCESS(Buffer
)
41 TEST_PPAPI_OUT_OF_PROCESS(Buffer
)
43 TEST_PPAPI_IN_PROCESS(CharSet
)
44 TEST_PPAPI_OUT_OF_PROCESS(CharSet
)
46 TEST_PPAPI_IN_PROCESS(Console
)
47 TEST_PPAPI_OUT_OF_PROCESS(Console
)
49 TEST_PPAPI_IN_PROCESS(Core
)
50 TEST_PPAPI_OUT_OF_PROCESS(Core
)
52 TEST_PPAPI_IN_PROCESS(Crypto
)
53 TEST_PPAPI_OUT_OF_PROCESS(Crypto
)
55 TEST_PPAPI_IN_PROCESS(Graphics2D
)
56 TEST_PPAPI_OUT_OF_PROCESS(Graphics2D
)
58 TEST_PPAPI_IN_PROCESS(ImageData
)
59 TEST_PPAPI_OUT_OF_PROCESS(ImageData
)
61 TEST_PPAPI_OUT_OF_PROCESS(InputEvent
)
63 // "Instance" tests are really InstancePrivate tests. InstancePrivate is not
64 // supported in NaCl, so these tests are only run trusted.
65 // Also note that these tests are run separately on purpose (versus collapsed
66 // in to one IN_PROC_BROWSER_TEST_F macro), because some of them have leaks
67 // on purpose that will look like failures to tests that are run later.
68 TEST_PPAPI_IN_PROCESS(Instance_ExecuteScript
)
69 TEST_PPAPI_OUT_OF_PROCESS(Instance_ExecuteScript
)
71 IN_PROC_BROWSER_TEST_F(PPAPITest
,
72 Instance_ExecuteScriptAtInstanceShutdown
) {
73 // In other tests, we use one call to RunTest so that the tests can all run
74 // in one plugin instance. This saves time on loading the plugin (especially
75 // for NaCl). Here, we actually want to destroy the Instance, to test whether
76 // the destructor can run ExecuteScript successfully. That's why we have two
77 // separate calls to RunTest; the second one forces a navigation which
78 // destroys the instance from the prior RunTest.
79 // See test_instance_deprecated.cc for more information.
80 RunTest("Instance_SetupExecuteScriptAtInstanceShutdown");
81 RunTest("Instance_ExecuteScriptAtInstanceShutdown");
83 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest
,
84 DISABLE_IF_TSAN(Instance_ExecuteScriptAtInstanceShutdown
)) {
85 // (See the comment for the in-process version of this test above)
86 RunTest("Instance_SetupExecuteScriptAtInstanceShutdown");
87 RunTest("Instance_ExecuteScriptAtInstanceShutdown");
90 TEST_PPAPI_IN_PROCESS(Instance_LeakedObjectDestructors
)
91 TEST_PPAPI_OUT_OF_PROCESS(Instance_LeakedObjectDestructors
)
93 // We run and reload the RecursiveObjects test to ensure that the
94 // InstanceObject (and others) are properly cleaned up after the first run.
95 IN_PROC_BROWSER_TEST_F(PPAPITest
, Instance_RecursiveObjects
) {
96 RunTestAndReload("Instance_RecursiveObjects");
98 // TODO(dmichael): Make it work out-of-process (or at least see whether we
100 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest
,
101 DISABLED_Instance_RecursiveObjects
) {
102 RunTestAndReload("Instance_RecursiveObjects");
105 #if defined(OS_WIN) || defined(OS_LINUX)
106 // Flaky on Linux and Windows (crbug.com/438729)
107 #define MAYBE_MediaStreamAudioTrack DISABLED_MediaStreamAudioTrack
109 #define MAYBE_MediaStreamAudioTrack MediaStreamAudioTrack
111 TEST_PPAPI_OUT_OF_PROCESS(MAYBE_MediaStreamAudioTrack
)
113 TEST_PPAPI_OUT_OF_PROCESS(MediaStreamVideoTrack
)
115 TEST_PPAPI_IN_PROCESS(Memory
)
116 TEST_PPAPI_OUT_OF_PROCESS(Memory
)
118 TEST_PPAPI_OUT_OF_PROCESS(MessageHandler
)
120 TEST_PPAPI_OUT_OF_PROCESS(MessageLoop_Basics
)
121 TEST_PPAPI_OUT_OF_PROCESS(MessageLoop_Post
)
123 TEST_PPAPI_OUT_OF_PROCESS(NetworkProxy
)
125 // TODO(danakj): http://crbug.com/115286
126 TEST_PPAPI_IN_PROCESS(DISABLED_Scrollbar
)
127 // http://crbug.com/89961
128 TEST_PPAPI_OUT_OF_PROCESS(DISABLED_Scrollbar
)
130 TEST_PPAPI_IN_PROCESS(TraceEvent
)
131 TEST_PPAPI_OUT_OF_PROCESS(TraceEvent
)
133 TEST_PPAPI_OUT_OF_PROCESS(TrueTypeFont
)
135 TEST_PPAPI_IN_PROCESS(URLUtil
)
136 TEST_PPAPI_OUT_OF_PROCESS(URLUtil
)
138 TEST_PPAPI_IN_PROCESS(Var
)
139 TEST_PPAPI_OUT_OF_PROCESS(Var
)
141 // Flaky on mac, http://crbug.com/121107
142 #if defined(OS_MACOSX)
143 #define MAYBE_VarDeprecated DISABLED_VarDeprecated
145 #define MAYBE_VarDeprecated VarDeprecated
147 TEST_PPAPI_IN_PROCESS(VarDeprecated
)
148 TEST_PPAPI_OUT_OF_PROCESS(MAYBE_VarDeprecated
)
150 TEST_PPAPI_IN_PROCESS(VarResource
)
151 TEST_PPAPI_OUT_OF_PROCESS(VarResource
)
153 TEST_PPAPI_OUT_OF_PROCESS(VideoDecoder
)
155 TEST_PPAPI_IN_PROCESS(VideoDecoderDev
)
156 TEST_PPAPI_OUT_OF_PROCESS(VideoDecoderDev
)
158 TEST_PPAPI_OUT_OF_PROCESS(VideoEncoder
)
161 } // namespace content