• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 
5 #include "content/test/ppapi/ppapi_test.h"
6 #include "ppapi/shared_impl/test_harness_utils.h"
7 
8 // This file lists tests for Pepper APIs (without NaCl) against content_shell.
9 // TODO(teravest): Move more tests here. http://crbug.com/371873
10 
11 // See chrome/test/ppapi/ppapi_browsertests.cc for Pepper testing that's
12 // covered in browser_tests.
13 
14 namespace content {
15 namespace {
16 
17 // This macro finesses macro expansion to do what we want.
18 #define STRIP_PREFIXES(test_name) ppapi::StripTestPrefixes(#test_name)
19 
20 #define TEST_PPAPI_IN_PROCESS(test_name) \
21   IN_PROC_BROWSER_TEST_F(PPAPITest, test_name) { \
22     RunTest(STRIP_PREFIXES(test_name)); \
23   }
24 
25 #define TEST_PPAPI_OUT_OF_PROCESS(test_name) \
26   IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, test_name) { \
27     RunTest(STRIP_PREFIXES(test_name)); \
28   }
29 
30 TEST_PPAPI_IN_PROCESS(BrowserFont)
31 // crbug.com/308949
32 #if defined(OS_WIN)
33 #define MAYBE_OUT_BrowserFont DISABLED_BrowserFont
34 #else
35 #define MAYBE_OUT_BrowserFont BrowserFont
36 #endif
TEST_PPAPI_OUT_OF_PROCESS(MAYBE_OUT_BrowserFont)37 TEST_PPAPI_OUT_OF_PROCESS(MAYBE_OUT_BrowserFont)
38 
39 TEST_PPAPI_IN_PROCESS(Buffer)
40 TEST_PPAPI_OUT_OF_PROCESS(Buffer)
41 
42 TEST_PPAPI_IN_PROCESS(CharSet)
43 TEST_PPAPI_OUT_OF_PROCESS(CharSet)
44 
45 TEST_PPAPI_IN_PROCESS(Console)
46 TEST_PPAPI_OUT_OF_PROCESS(Console)
47 
48 TEST_PPAPI_IN_PROCESS(Core)
49 TEST_PPAPI_OUT_OF_PROCESS(Core)
50 
51 TEST_PPAPI_IN_PROCESS(Crypto)
52 TEST_PPAPI_OUT_OF_PROCESS(Crypto)
53 
54 TEST_PPAPI_IN_PROCESS(Graphics2D)
55 TEST_PPAPI_OUT_OF_PROCESS(Graphics2D)
56 
57 TEST_PPAPI_IN_PROCESS(ImageData)
58 TEST_PPAPI_OUT_OF_PROCESS(ImageData)
59 
60 TEST_PPAPI_OUT_OF_PROCESS(InputEvent)
61 
62 // "Instance" tests are really InstancePrivate tests. InstancePrivate is not
63 // supported in NaCl, so these tests are only run trusted.
64 // Also note that these tests are run separately on purpose (versus collapsed
65 // in to one IN_PROC_BROWSER_TEST_F macro), because some of them have leaks
66 // on purpose that will look like failures to tests that are run later.
67 TEST_PPAPI_IN_PROCESS(Instance_ExecuteScript)
68 TEST_PPAPI_OUT_OF_PROCESS(Instance_ExecuteScript)
69 
70 IN_PROC_BROWSER_TEST_F(PPAPITest,
71                        Instance_ExecuteScriptAtInstanceShutdown) {
72   // In other tests, we use one call to RunTest so that the tests can all run
73   // in one plugin instance. This saves time on loading the plugin (especially
74   // for NaCl). Here, we actually want to destroy the Instance, to test whether
75   // the destructor can run ExecuteScript successfully. That's why we have two
76   // separate calls to RunTest; the second one forces a navigation which
77   // destroys the instance from the prior RunTest.
78   // See test_instance_deprecated.cc for more information.
79   RunTest("Instance_SetupExecuteScriptAtInstanceShutdown");
80   RunTest("Instance_ExecuteScriptAtInstanceShutdown");
81 }
IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest,Instance_ExecuteScriptAtInstanceShutdown)82 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest,
83                        Instance_ExecuteScriptAtInstanceShutdown) {
84   // (See the comment for the in-process version of this test above)
85   RunTest("Instance_SetupExecuteScriptAtInstanceShutdown");
86   RunTest("Instance_ExecuteScriptAtInstanceShutdown");
87 }
88 
89 TEST_PPAPI_IN_PROCESS(Instance_LeakedObjectDestructors)
TEST_PPAPI_OUT_OF_PROCESS(Instance_LeakedObjectDestructors)90 TEST_PPAPI_OUT_OF_PROCESS(Instance_LeakedObjectDestructors)
91 
92 // We run and reload the RecursiveObjects test to ensure that the
93 // InstanceObject (and others) are properly cleaned up after the first run.
94 IN_PROC_BROWSER_TEST_F(PPAPITest, Instance_RecursiveObjects) {
95   RunTestAndReload("Instance_RecursiveObjects");
96 }
97 // TODO(dmichael): Make it work out-of-process (or at least see whether we
98 // care).
IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest,DISABLED_Instance_RecursiveObjects)99 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest,
100                        DISABLED_Instance_RecursiveObjects) {
101   RunTestAndReload("Instance_RecursiveObjects");
102 }
103 
104 TEST_PPAPI_OUT_OF_PROCESS(MediaStreamAudioTrack)
105 
106 TEST_PPAPI_OUT_OF_PROCESS(MediaStreamVideoTrack)
107 
108 TEST_PPAPI_IN_PROCESS(Memory)
109 TEST_PPAPI_OUT_OF_PROCESS(Memory)
110 
111 TEST_PPAPI_OUT_OF_PROCESS(MessageHandler)
112 
113 TEST_PPAPI_OUT_OF_PROCESS(MessageLoop_Basics)
114 TEST_PPAPI_OUT_OF_PROCESS(MessageLoop_Post)
115 
116 TEST_PPAPI_OUT_OF_PROCESS(NetworkProxy)
117 
118 // TODO(danakj): http://crbug.com/115286
119 TEST_PPAPI_IN_PROCESS(DISABLED_Scrollbar)
120 // http://crbug.com/89961
121 TEST_PPAPI_OUT_OF_PROCESS(DISABLED_Scrollbar)
122 
123 TEST_PPAPI_IN_PROCESS(TraceEvent)
124 TEST_PPAPI_OUT_OF_PROCESS(TraceEvent)
125 
126 TEST_PPAPI_OUT_OF_PROCESS(TrueTypeFont)
127 
128 TEST_PPAPI_IN_PROCESS(URLUtil)
129 TEST_PPAPI_OUT_OF_PROCESS(URLUtil)
130 
131 TEST_PPAPI_IN_PROCESS(Var)
132 TEST_PPAPI_OUT_OF_PROCESS(Var)
133 
134 // Flaky on mac, http://crbug.com/121107
135 #if defined(OS_MACOSX)
136 #define MAYBE_VarDeprecated DISABLED_VarDeprecated
137 #else
138 #define MAYBE_VarDeprecated VarDeprecated
139 #endif
140 TEST_PPAPI_IN_PROCESS(VarDeprecated)
141 TEST_PPAPI_OUT_OF_PROCESS(MAYBE_VarDeprecated)
142 
143 TEST_PPAPI_IN_PROCESS(VarResource)
144 TEST_PPAPI_OUT_OF_PROCESS(VarResource)
145 
146 TEST_PPAPI_OUT_OF_PROCESS(VideoDecoder)
147 
148 TEST_PPAPI_IN_PROCESS(VideoDecoderDev)
149 TEST_PPAPI_OUT_OF_PROCESS(VideoDecoderDev)
150 
151 }  // namespace
152 }  // namespace content
153