[email protected] | 745fc52 | 2014-05-28 21:54:45 | [diff] [blame] | 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 | |
avi | 66a0772 | 2015-12-25 23:38:12 | [diff] [blame] | 5 | #include "build/build_config.h" |
[email protected] | 745fc52 | 2014-05-28 21:54:45 | [diff] [blame] | 6 | #include "content/test/ppapi/ppapi_test.h" |
tommycli | a88b609 | 2015-05-14 17:54:01 | [diff] [blame] | 7 | #include "ppapi/shared_impl/test_utils.h" |
[email protected] | 745fc52 | 2014-05-28 21:54:45 | [diff] [blame] | 8 | |
| 9 | // This file lists tests for Pepper APIs (without NaCl) against content_shell. |
| 10 | // TODO(teravest): Move more tests here. http://crbug.com/371873 |
| 11 | |
| 12 | // See chrome/test/ppapi/ppapi_browsertests.cc for Pepper testing that's |
| 13 | // covered in browser_tests. |
| 14 | |
| 15 | namespace content { |
| 16 | namespace { |
| 17 | |
| 18 | // This macro finesses macro expansion to do what we want. |
| 19 | #define STRIP_PREFIXES(test_name) ppapi::StripTestPrefixes(#test_name) |
| 20 | |
glider | aacff2b | 2015-01-14 12:03:19 | [diff] [blame] | 21 | #if defined(THREAD_SANITIZER) |
| 22 | #define DISABLE_IF_TSAN(test_name) DISABLED_##test_name |
| 23 | #else |
| 24 | #define DISABLE_IF_TSAN(test_name) test_name |
| 25 | #endif |
| 26 | |
[email protected] | 745fc52 | 2014-05-28 21:54:45 | [diff] [blame] | 27 | #define TEST_PPAPI_IN_PROCESS(test_name) \ |
| 28 | IN_PROC_BROWSER_TEST_F(PPAPITest, test_name) { \ |
| 29 | RunTest(STRIP_PREFIXES(test_name)); \ |
| 30 | } |
| 31 | |
glider | aacff2b | 2015-01-14 12:03:19 | [diff] [blame] | 32 | // OutOfProcessPPAPITest tests time out under ThreadSanitizer, |
| 33 | // see https://crbug.com/448323. |
[email protected] | 745fc52 | 2014-05-28 21:54:45 | [diff] [blame] | 34 | #define TEST_PPAPI_OUT_OF_PROCESS(test_name) \ |
glider | aacff2b | 2015-01-14 12:03:19 | [diff] [blame] | 35 | IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, DISABLE_IF_TSAN(test_name)) { \ |
[email protected] | 745fc52 | 2014-05-28 21:54:45 | [diff] [blame] | 36 | RunTest(STRIP_PREFIXES(test_name)); \ |
| 37 | } |
| 38 | |
dpranke | 98afc7a | 2016-06-16 19:49:25 | [diff] [blame] | 39 | // Doesn't work in GN CrOS ozone builds yet, http://crbug.com/619765 |
| 40 | #if defined(OS_CHROMEOS) && defined(USE_OZONE) |
| 41 | #define MAYBE_BrowserFont DISABLED_BrowserFont |
| 42 | #else |
| 43 | #define MAYBE_BrowserFont BrowserFont |
| 44 | #endif |
| 45 | TEST_PPAPI_OUT_OF_PROCESS(MAYBE_BrowserFont) |
[email protected] | 585765a | 2014-05-29 16:34:26 | [diff] [blame] | 46 | |
| 47 | TEST_PPAPI_IN_PROCESS(Buffer) |
| 48 | TEST_PPAPI_OUT_OF_PROCESS(Buffer) |
| 49 | |
| 50 | TEST_PPAPI_IN_PROCESS(CharSet) |
| 51 | TEST_PPAPI_OUT_OF_PROCESS(CharSet) |
| 52 | |
| 53 | TEST_PPAPI_IN_PROCESS(Console) |
| 54 | TEST_PPAPI_OUT_OF_PROCESS(Console) |
| 55 | |
[email protected] | ae1353c | 2014-06-02 21:14:34 | [diff] [blame] | 56 | TEST_PPAPI_IN_PROCESS(Core) |
| 57 | TEST_PPAPI_OUT_OF_PROCESS(Core) |
| 58 | |
[email protected] | 745fc52 | 2014-05-28 21:54:45 | [diff] [blame] | 59 | TEST_PPAPI_IN_PROCESS(Crypto) |
| 60 | TEST_PPAPI_OUT_OF_PROCESS(Crypto) |
| 61 | |
[email protected] | 585765a | 2014-05-29 16:34:26 | [diff] [blame] | 62 | TEST_PPAPI_IN_PROCESS(Graphics2D) |
| 63 | TEST_PPAPI_OUT_OF_PROCESS(Graphics2D) |
| 64 | |
| 65 | TEST_PPAPI_IN_PROCESS(ImageData) |
| 66 | TEST_PPAPI_OUT_OF_PROCESS(ImageData) |
| 67 | |
| 68 | TEST_PPAPI_OUT_OF_PROCESS(InputEvent) |
| 69 | |
| 70 | // "Instance" tests are really InstancePrivate tests. InstancePrivate is not |
| 71 | // supported in NaCl, so these tests are only run trusted. |
| 72 | // Also note that these tests are run separately on purpose (versus collapsed |
| 73 | // in to one IN_PROC_BROWSER_TEST_F macro), because some of them have leaks |
| 74 | // on purpose that will look like failures to tests that are run later. |
| 75 | TEST_PPAPI_IN_PROCESS(Instance_ExecuteScript) |
| 76 | TEST_PPAPI_OUT_OF_PROCESS(Instance_ExecuteScript) |
| 77 | |
| 78 | IN_PROC_BROWSER_TEST_F(PPAPITest, |
| 79 | Instance_ExecuteScriptAtInstanceShutdown) { |
| 80 | // In other tests, we use one call to RunTest so that the tests can all run |
| 81 | // in one plugin instance. This saves time on loading the plugin (especially |
| 82 | // for NaCl). Here, we actually want to destroy the Instance, to test whether |
| 83 | // the destructor can run ExecuteScript successfully. That's why we have two |
| 84 | // separate calls to RunTest; the second one forces a navigation which |
| 85 | // destroys the instance from the prior RunTest. |
| 86 | // See test_instance_deprecated.cc for more information. |
| 87 | RunTest("Instance_SetupExecuteScriptAtInstanceShutdown"); |
| 88 | RunTest("Instance_ExecuteScriptAtInstanceShutdown"); |
| 89 | } |
| 90 | IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, |
glider | aacff2b | 2015-01-14 12:03:19 | [diff] [blame] | 91 | DISABLE_IF_TSAN(Instance_ExecuteScriptAtInstanceShutdown)) { |
[email protected] | 585765a | 2014-05-29 16:34:26 | [diff] [blame] | 92 | // (See the comment for the in-process version of this test above) |
| 93 | RunTest("Instance_SetupExecuteScriptAtInstanceShutdown"); |
| 94 | RunTest("Instance_ExecuteScriptAtInstanceShutdown"); |
| 95 | } |
| 96 | |
| 97 | TEST_PPAPI_IN_PROCESS(Instance_LeakedObjectDestructors) |
| 98 | TEST_PPAPI_OUT_OF_PROCESS(Instance_LeakedObjectDestructors) |
| 99 | |
[email protected] | bd8f27c | 2014-05-31 01:12:55 | [diff] [blame] | 100 | // We run and reload the RecursiveObjects test to ensure that the |
| 101 | // InstanceObject (and others) are properly cleaned up after the first run. |
| 102 | IN_PROC_BROWSER_TEST_F(PPAPITest, Instance_RecursiveObjects) { |
| 103 | RunTestAndReload("Instance_RecursiveObjects"); |
| 104 | } |
| 105 | // TODO(dmichael): Make it work out-of-process (or at least see whether we |
| 106 | // care). |
| 107 | IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, |
| 108 | DISABLED_Instance_RecursiveObjects) { |
| 109 | RunTestAndReload("Instance_RecursiveObjects"); |
| 110 | } |
| 111 | |
tsergeant | d37c601 | 2015-07-16 05:55:10 | [diff] [blame] | 112 | #if defined(OS_WIN) || defined(OS_LINUX) |
| 113 | // Flaky on Linux and Windows (crbug.com/438729) |
pkotwicz | c071901b | 2014-12-03 23:02:10 | [diff] [blame] | 114 | #define MAYBE_MediaStreamAudioTrack DISABLED_MediaStreamAudioTrack |
| 115 | #else |
| 116 | #define MAYBE_MediaStreamAudioTrack MediaStreamAudioTrack |
| 117 | #endif |
| 118 | TEST_PPAPI_OUT_OF_PROCESS(MAYBE_MediaStreamAudioTrack) |
[email protected] | bd8f27c | 2014-05-31 01:12:55 | [diff] [blame] | 119 | |
| 120 | TEST_PPAPI_OUT_OF_PROCESS(MediaStreamVideoTrack) |
| 121 | |
[email protected] | 585765a | 2014-05-29 16:34:26 | [diff] [blame] | 122 | TEST_PPAPI_IN_PROCESS(Memory) |
| 123 | TEST_PPAPI_OUT_OF_PROCESS(Memory) |
| 124 | |
[email protected] | e87640bd | 2014-06-18 16:44:00 | [diff] [blame] | 125 | TEST_PPAPI_OUT_OF_PROCESS(MessageHandler) |
| 126 | |
[email protected] | bd8f27c | 2014-05-31 01:12:55 | [diff] [blame] | 127 | TEST_PPAPI_OUT_OF_PROCESS(MessageLoop_Basics) |
| 128 | TEST_PPAPI_OUT_OF_PROCESS(MessageLoop_Post) |
| 129 | |
| 130 | TEST_PPAPI_OUT_OF_PROCESS(NetworkProxy) |
| 131 | |
[email protected] | 585765a | 2014-05-29 16:34:26 | [diff] [blame] | 132 | // TODO(danakj): http://crbug.com/115286 |
| 133 | TEST_PPAPI_IN_PROCESS(DISABLED_Scrollbar) |
| 134 | // http://crbug.com/89961 |
| 135 | TEST_PPAPI_OUT_OF_PROCESS(DISABLED_Scrollbar) |
| 136 | |
[email protected] | 745fc52 | 2014-05-28 21:54:45 | [diff] [blame] | 137 | TEST_PPAPI_IN_PROCESS(TraceEvent) |
| 138 | TEST_PPAPI_OUT_OF_PROCESS(TraceEvent) |
| 139 | |
dpranke | 98afc7a | 2016-06-16 19:49:25 | [diff] [blame] | 140 | // Doesn't work in GN CrOS ozone builds yet, http://crbug.com/619765 |
| 141 | #if defined(OS_CHROMEOS) && defined(USE_OZONE) |
| 142 | #define MAYBE_TrueTypeFont DISABLED_TrueTypeFont |
| 143 | #else |
| 144 | #define MAYBE_TrueTypeFont TrueTypeFont |
| 145 | #endif |
| 146 | TEST_PPAPI_OUT_OF_PROCESS(MAYBE_TrueTypeFont) |
[email protected] | bd8f27c | 2014-05-31 01:12:55 | [diff] [blame] | 147 | |
[email protected] | 585765a | 2014-05-29 16:34:26 | [diff] [blame] | 148 | TEST_PPAPI_IN_PROCESS(URLUtil) |
| 149 | TEST_PPAPI_OUT_OF_PROCESS(URLUtil) |
| 150 | |
| 151 | TEST_PPAPI_IN_PROCESS(Var) |
| 152 | TEST_PPAPI_OUT_OF_PROCESS(Var) |
| 153 | |
| 154 | // Flaky on mac, http://crbug.com/121107 |
| 155 | #if defined(OS_MACOSX) |
| 156 | #define MAYBE_VarDeprecated DISABLED_VarDeprecated |
| 157 | #else |
| 158 | #define MAYBE_VarDeprecated VarDeprecated |
| 159 | #endif |
| 160 | TEST_PPAPI_IN_PROCESS(VarDeprecated) |
| 161 | TEST_PPAPI_OUT_OF_PROCESS(MAYBE_VarDeprecated) |
| 162 | |
| 163 | TEST_PPAPI_IN_PROCESS(VarResource) |
| 164 | TEST_PPAPI_OUT_OF_PROCESS(VarResource) |
| 165 | |
vabr | 69f341e | 2016-04-13 10:54:58 | [diff] [blame] | 166 | // Flaky on Win, Linux and CrOS, http://crbug.com/602877 |
vabr | 5501769 | 2016-04-13 12:05:32 | [diff] [blame] | 167 | #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS) |
vabr | 69f341e | 2016-04-13 10:54:58 | [diff] [blame] | 168 | #define MAYBE_VideoDecoder DISABLED_VideoDecoder |
| 169 | #else |
| 170 | #define MAYBE_VideoDecoder VideoDecoder |
| 171 | #endif |
| 172 | TEST_PPAPI_OUT_OF_PROCESS(MAYBE_VideoDecoder) |
[email protected] | 0ff052d | 2014-06-13 15:00:14 | [diff] [blame] | 173 | |
[email protected] | 585765a | 2014-05-29 16:34:26 | [diff] [blame] | 174 | TEST_PPAPI_IN_PROCESS(VideoDecoderDev) |
| 175 | TEST_PPAPI_OUT_OF_PROCESS(VideoDecoderDev) |
| 176 | |
lionel.g.landwerlin | c3f1512 | 2015-02-25 01:20:58 | [diff] [blame] | 177 | TEST_PPAPI_OUT_OF_PROCESS(VideoEncoder) |
| 178 | |
[email protected] | 745fc52 | 2014-05-28 21:54:45 | [diff] [blame] | 179 | } // namespace |
| 180 | } // namespace content |