Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: chrome/test/plugin/plugin_test.cpp

Issue 42684: It looks like the Chrome NPAPI plugin installer has been broken since we firs... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/chrome.sln ('k') | webkit/default_plugin/plugin_impl_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2008, Google Inc. 1 // Copyright 2008-2009, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
11 // copyright notice, this list of conditions and the following disclaimer 11 // copyright notice, this list of conditions and the following disclaimer
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include <string.h> 47 #include <string.h>
48 #include <memory.h> 48 #include <memory.h>
49 49
50 #include "base/file_util.h" 50 #include "base/file_util.h"
51 #include "base/registry.h" 51 #include "base/registry.h"
52 #include "chrome/common/chrome_switches.h" 52 #include "chrome/common/chrome_switches.h"
53 #include "chrome/common/chrome_paths.h" 53 #include "chrome/common/chrome_paths.h"
54 #include "chrome/test/automation/tab_proxy.h" 54 #include "chrome/test/automation/tab_proxy.h"
55 #include "chrome/test/ui/ui_test.h" 55 #include "chrome/test/ui/ui_test.h"
56 #include "net/base/net_util.h" 56 #include "net/base/net_util.h"
57 #include "third_party/npapi/bindings/npapi.h"
58 #include "webkit/default_plugin/plugin_impl.h"
57 #include "webkit/glue/plugins/plugin_constants_win.h" 59 #include "webkit/glue/plugins/plugin_constants_win.h"
58 #include "webkit/glue/plugins/plugin_list.h" 60 #include "webkit/glue/plugins/plugin_list.h"
59 61
60 const char kTestCompleteCookie[] = "status"; 62 const char kTestCompleteCookie[] = "status";
61 const char kTestCompleteSuccess[] = "OK"; 63 const char kTestCompleteSuccess[] = "OK";
62 const int kShortWaitTimeout = 10 * 1000; 64 const int kShortWaitTimeout = 10 * 1000;
63 const int kLongWaitTimeout = 30 * 1000; 65 const int kLongWaitTimeout = 30 * 1000;
64 66
65 class PluginTest : public UITest { 67 class PluginTest : public UITest {
66 protected: 68 protected:
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 } 217 }
216 218
217 TEST_F(ActiveXTest, WMP) { 219 TEST_F(ActiveXTest, WMP) {
218 TestActiveX(L"activex_wmp.html", kLongWaitTimeout, false); 220 TestActiveX(L"activex_wmp.html", kLongWaitTimeout, false);
219 } 221 }
220 222
221 TEST_F(ActiveXTest, CustomScripting) { 223 TEST_F(ActiveXTest, CustomScripting) {
222 TestActiveX(L"activex_custom_scripting.html", kShortWaitTimeout, true); 224 TestActiveX(L"activex_custom_scripting.html", kShortWaitTimeout, true);
223 } 225 }
224 226
227 // The default plugin tests defined below rely on the following webkit
228 // functions and the IsPluginProcess function which is defined in the global
229 // namespace. Stubbed these out for now.
230 namespace webkit_glue {
231
232 bool DownloadUrl(const std::string& url, HWND caller_window) {
233 return false;
234 }
235
236 bool GetPluginFinderURL(std::string* plugin_finder_url) {
237 return true;
238 }
239
240 } // namespace webkit_glue
241
242 bool IsPluginProcess() {
243 return false;
244 }
245
246 TEST_F(PluginTest, DefaultPluginParsingTest) {
247 PluginInstallerImpl plugin_installer(NP_EMBED);
248 NPP_t plugin_instance = {0};
249
250 char *arg_names[] = {
251 "classid",
252 "codebase"
253 };
254
255 char *arg_values[] = {
256 "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
257 "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab",
258 };
259
260 bool is_activex = false;
261 std::string raw_activex_clsid;
262 std::string activex_clsid;
263 std::string activex_codebase;
264 std::string plugin_download_url;
265 std::string plugin_finder_url;
266
267 ASSERT_TRUE(PluginInstallerImpl::ParseInstantiationArguments(
268 "application/x-shockwave-flash",
269 &plugin_instance,
270 arraysize(arg_names),
271 arg_names,
272 arg_values,
273 &raw_activex_clsid,
274 &is_activex,
275 &activex_clsid,
276 &activex_codebase,
277 &plugin_download_url,
278 &plugin_finder_url));
279
280 EXPECT_EQ(is_activex, false);
281
282
283 ASSERT_TRUE(PluginInstallerImpl::ParseInstantiationArguments(
284 "",
285 &plugin_instance,
286 arraysize(arg_names),
287 arg_names,
288 arg_values,
289 &raw_activex_clsid,
290 &is_activex,
291 &activex_clsid,
292 &activex_codebase,
293 &plugin_download_url,
294 &plugin_finder_url));
295
296 EXPECT_EQ(is_activex, true);
297 EXPECT_EQ(
298 activex_codebase,
299 "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab");
300
301 EXPECT_EQ(activex_clsid, "{D27CDB6E-AE6D-11cf-96B8-444553540000}");
302 EXPECT_EQ(raw_activex_clsid, "D27CDB6E-AE6D-11cf-96B8-444553540000");
303
304 EXPECT_EQ(
305 activex_codebase,
306 "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab");
307 }
OLDNEW
« no previous file with comments | « chrome/chrome.sln ('k') | webkit/default_plugin/plugin_impl_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698