| OLD | NEW |
| 1 // Copyright 2008-2009, 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 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 #include <windows.h> | 40 #include <windows.h> |
| 41 #include <shellapi.h> | 41 #include <shellapi.h> |
| 42 #include <shlobj.h> | 42 #include <shlobj.h> |
| 43 #include <atlbase.h> | 43 #include <atlbase.h> |
| 44 #include <comutil.h> | 44 #include <comutil.h> |
| 45 | 45 |
| 46 #include <stdlib.h> | 46 #include <stdlib.h> |
| 47 #include <string.h> | 47 #include <string.h> |
| 48 #include <memory.h> | 48 #include <memory.h> |
| 49 | 49 |
| 50 #include "base/file_path.h" |
| 50 #include "base/file_util.h" | 51 #include "base/file_util.h" |
| 51 #include "base/registry.h" | 52 #include "base/registry.h" |
| 52 #include "chrome/common/chrome_switches.h" | 53 #include "chrome/common/chrome_switches.h" |
| 53 #include "chrome/common/chrome_paths.h" | 54 #include "chrome/common/chrome_paths.h" |
| 54 #include "chrome/test/automation/tab_proxy.h" | 55 #include "chrome/test/automation/tab_proxy.h" |
| 55 #include "chrome/test/ui/ui_test.h" | 56 #include "chrome/test/ui/ui_test.h" |
| 56 #include "net/base/net_util.h" | 57 #include "net/base/net_util.h" |
| 57 #include "third_party/npapi/bindings/npapi.h" | 58 #include "third_party/npapi/bindings/npapi.h" |
| 58 #include "webkit/default_plugin/plugin_impl.h" | 59 #include "webkit/default_plugin/plugin_impl.h" |
| 59 #include "webkit/glue/plugins/plugin_constants_win.h" | 60 #include "webkit/glue/plugins/plugin_constants_win.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 96 |
| 96 void TestPlugin(const std::wstring& test_case, int timeout) { | 97 void TestPlugin(const std::wstring& test_case, int timeout) { |
| 97 GURL url = GetTestUrl(test_case); | 98 GURL url = GetTestUrl(test_case); |
| 98 NavigateToURL(url); | 99 NavigateToURL(url); |
| 99 WaitForFinish(timeout); | 100 WaitForFinish(timeout); |
| 100 } | 101 } |
| 101 | 102 |
| 102 // Generate the URL for testing a particular test. | 103 // Generate the URL for testing a particular test. |
| 103 // HTML for the tests is all located in test_directory\plugin\<testcase> | 104 // HTML for the tests is all located in test_directory\plugin\<testcase> |
| 104 GURL GetTestUrl(const std::wstring &test_case) { | 105 GURL GetTestUrl(const std::wstring &test_case) { |
| 105 std::wstring path; | 106 FilePath path; |
| 106 PathService::Get(chrome::DIR_TEST_DATA, &path); | 107 PathService::Get(chrome::DIR_TEST_DATA, &path); |
| 107 file_util::AppendToPath(&path, L"plugin"); | 108 path = path.AppendASCII("plugin"); |
| 108 file_util::AppendToPath(&path, test_case); | 109 path = path.Append(FilePath::FromWStringHack(test_case)); |
| 109 return net::FilePathToFileURL(path); | 110 return net::FilePathToFileURL(path); |
| 110 } | 111 } |
| 111 | 112 |
| 112 // Waits for the test case to finish. | 113 // Waits for the test case to finish. |
| 113 void WaitForFinish(const int wait_time) { | 114 void WaitForFinish(const int wait_time) { |
| 114 const int kSleepTime = 500; // 2 times per second | 115 const int kSleepTime = 500; // 2 times per second |
| 115 const int kMaxIntervals = wait_time / kSleepTime; | 116 const int kMaxIntervals = wait_time / kSleepTime; |
| 116 | 117 |
| 117 GURL url = GetTestUrl(L"done"); | 118 GURL url = GetTestUrl(L"done"); |
| 118 scoped_ptr<TabProxy> tab(GetActiveTab()); | 119 scoped_ptr<TabProxy> tab(GetActiveTab()); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 activex_codebase, | 299 activex_codebase, |
| 299 "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"); | 300 "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"); |
| 300 | 301 |
| 301 EXPECT_EQ(activex_clsid, "{D27CDB6E-AE6D-11cf-96B8-444553540000}"); | 302 EXPECT_EQ(activex_clsid, "{D27CDB6E-AE6D-11cf-96B8-444553540000}"); |
| 302 EXPECT_EQ(raw_activex_clsid, "D27CDB6E-AE6D-11cf-96B8-444553540000"); | 303 EXPECT_EQ(raw_activex_clsid, "D27CDB6E-AE6D-11cf-96B8-444553540000"); |
| 303 | 304 |
| 304 EXPECT_EQ( | 305 EXPECT_EQ( |
| 305 activex_codebase, | 306 activex_codebase, |
| 306 "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"); | 307 "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"); |
| 307 } | 308 } |
| OLD | NEW |