OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "base/test/test_timeouts.h" | 7 #include "base/test/test_timeouts.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
10 #include "chrome/test/automation/tab_proxy.h" | 10 #include "chrome/test/automation/tab_proxy.h" |
11 #include "chrome/test/ui/ui_test.h" | 11 #include "chrome/test/ui/ui_test.h" |
12 #include "net/base/net_util.h" | 12 #include "net/base/net_util.h" |
13 #include "net/test/test_server.h" | 13 #include "net/test/test_server.h" |
14 #include "webkit/plugins/plugin_switches.h" | 14 #include "webkit/plugins/plugin_switches.h" |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 // Platform-specific filename relative to the chrome executable. | 18 // Platform-specific filename relative to the chrome executable. |
19 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
20 const wchar_t library_name[] = L"ppapi_tests.dll"; | 20 const wchar_t library_name[] = L"ppapi_tests.dll"; |
21 #elif defined(OS_MACOSX) | 21 #elif defined(OS_MACOSX) |
22 const char library_name[] = "ppapi_tests.plugin"; | 22 const char library_name[] = "ppapi_tests.plugin"; |
23 #elif defined(OS_POSIX) | 23 #elif defined(OS_POSIX) |
24 const char library_name[] = "libppapi_tests.so"; | 24 const char library_name[] = "libppapi_tests.so"; |
25 #endif | 25 #endif |
26 | 26 |
27 } // namespace | 27 } // namespace |
28 | 28 |
| 29 // In-process plugin test runner. See OutOfProcessPPAPITest below for the |
| 30 // out-of-process version. |
29 class PPAPITest : public UITest { | 31 class PPAPITest : public UITest { |
30 public: | 32 public: |
31 PPAPITest() { | 33 PPAPITest() { |
32 // Append the switch to register the pepper plugin. | 34 // Append the switch to register the pepper plugin. |
33 // library name = <out dir>/<test_name>.<library_extension> | 35 // library name = <out dir>/<test_name>.<library_extension> |
34 // MIME type = application/x-ppapi-<test_name> | 36 // MIME type = application/x-ppapi-<test_name> |
35 FilePath plugin_dir; | 37 FilePath plugin_dir; |
36 PathService::Get(base::DIR_EXE, &plugin_dir); | 38 PathService::Get(base::DIR_EXE, &plugin_dir); |
37 | 39 |
38 FilePath plugin_lib = plugin_dir.Append(library_name); | 40 FilePath plugin_lib = plugin_dir.Append(library_name); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 << "Plugin couldn't be loaded. Make sure the PPAPI test plugin is " | 111 << "Plugin couldn't be loaded. Make sure the PPAPI test plugin is " |
110 << "built, in the right place, and doesn't have any missing symbols."; | 112 << "built, in the right place, and doesn't have any missing symbols."; |
111 | 113 |
112 std::string escaped_value = | 114 std::string escaped_value = |
113 WaitUntilCookieNonEmpty(tab.get(), test_url, | 115 WaitUntilCookieNonEmpty(tab.get(), test_url, |
114 "COMPLETION_COOKIE", TestTimeouts::large_test_timeout_ms()); | 116 "COMPLETION_COOKIE", TestTimeouts::large_test_timeout_ms()); |
115 EXPECT_STREQ("PASS", escaped_value.c_str()); | 117 EXPECT_STREQ("PASS", escaped_value.c_str()); |
116 } | 118 } |
117 }; | 119 }; |
118 | 120 |
| 121 // Variant of PPAPITest that runs plugins out-of-process to test proxy |
| 122 // codepaths. |
| 123 class OutOfProcessPPAPITest : public PPAPITest { |
| 124 public: |
| 125 OutOfProcessPPAPITest() { |
| 126 // Run PPAPI out-of-process to exercise proxy implementations. |
| 127 launch_arguments_.AppendSwitch(switches::kPpapiOutOfProcess); |
| 128 } |
| 129 }; |
| 130 |
119 TEST_F(PPAPITest, Broker) { | 131 TEST_F(PPAPITest, Broker) { |
120 RunTest("Broker"); | 132 RunTest("Broker"); |
121 } | 133 } |
122 | 134 |
123 TEST_F(PPAPITest, CursorControl) { | 135 TEST_F(PPAPITest, CursorControl) { |
124 RunTest("CursorControl"); | 136 RunTest("CursorControl"); |
125 } | 137 } |
126 | 138 |
127 TEST_F(PPAPITest, FAILS_Instance) { | 139 TEST_F(PPAPITest, FAILS_Instance) { |
128 RunTest("Instance"); | 140 RunTest("Instance"); |
129 } | 141 } |
130 | 142 |
131 TEST_F(PPAPITest, Graphics2D) { | 143 TEST_F(PPAPITest, Graphics2D) { |
132 RunTest("Graphics2D"); | 144 RunTest("Graphics2D"); |
133 } | 145 } |
134 | 146 |
135 TEST_F(PPAPITest, ImageData) { | 147 TEST_F(PPAPITest, ImageData) { |
136 RunTest("ImageData"); | 148 RunTest("ImageData"); |
137 } | 149 } |
138 | 150 |
139 TEST_F(PPAPITest, Buffer) { | 151 TEST_F(PPAPITest, Buffer) { |
140 RunTest("Buffer"); | 152 RunTest("Buffer"); |
141 } | 153 } |
| 154 #if !defined(OS_MACOSX) |
| 155 TEST_F(OutOfProcessPPAPITest, Buffer) { |
| 156 RunTest("Buffer"); |
| 157 } |
| 158 #endif |
142 | 159 |
143 TEST_F(PPAPITest, URLLoader) { | 160 TEST_F(PPAPITest, URLLoader) { |
144 RunTestViaHTTP("URLLoader"); | 161 RunTestViaHTTP("URLLoader"); |
145 } | 162 } |
146 | 163 |
147 TEST_F(PPAPITest,PaintAggregator) { | 164 TEST_F(PPAPITest,PaintAggregator) { |
148 RunTestViaHTTP("PaintAggregator"); | 165 RunTestViaHTTP("PaintAggregator"); |
149 } | 166 } |
150 | 167 |
151 // Fails consistently on Windows. See crbug.com/85010 for details. | 168 // Fails consistently on Windows. See crbug.com/85010 for details. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // Flaky on Mac, http://crbug.com/7094008. | 209 // Flaky on Mac, http://crbug.com/7094008. |
193 TEST_F(PPAPITest, MAYBE_DirectoryReader) { | 210 TEST_F(PPAPITest, MAYBE_DirectoryReader) { |
194 RunTestViaHTTP("DirectoryReader"); | 211 RunTestViaHTTP("DirectoryReader"); |
195 } | 212 } |
196 | 213 |
197 #if defined(ENABLE_P2P_APIS) | 214 #if defined(ENABLE_P2P_APIS) |
198 TEST_F(PPAPITest, Transport) { | 215 TEST_F(PPAPITest, Transport) { |
199 RunTest("Transport"); | 216 RunTest("Transport"); |
200 } | 217 } |
201 #endif // ENABLE_P2P_APIS | 218 #endif // ENABLE_P2P_APIS |
OLD | NEW |