OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // Tests for the top plugins to catch regressions in our plugin host code, as | 5 // Tests for the top plugins to catch regressions in our plugin host code, as |
6 // well as in the out of process code. Currently this tests: | 6 // well as in the out of process code. Currently this tests: |
7 // Flash | 7 // Flash |
8 // Real | 8 // Real |
9 // QuickTime | 9 // QuickTime |
10 // Windows Media Player | 10 // Windows Media Player |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "net/http/http_auth_handler_factory.h" | 44 #include "net/http/http_auth_handler_factory.h" |
45 #include "net/http/http_cache.h" | 45 #include "net/http/http_cache.h" |
46 #include "net/http/http_network_layer.h" | 46 #include "net/http/http_network_layer.h" |
47 #include "net/url_request/url_request_context.h" | 47 #include "net/url_request/url_request_context.h" |
48 #include "net/url_request/url_request_status.h" | 48 #include "net/url_request/url_request_status.h" |
49 #include "third_party/npapi/bindings/npapi.h" | 49 #include "third_party/npapi/bindings/npapi.h" |
50 #include "webkit/glue/plugins/plugin_constants_win.h" | 50 #include "webkit/glue/plugins/plugin_constants_win.h" |
51 #include "webkit/glue/plugins/plugin_list.h" | 51 #include "webkit/glue/plugins/plugin_list.h" |
52 | 52 |
53 #if defined(OS_WIN) | 53 #if defined(OS_WIN) |
54 #include "base/registry.h" | 54 #include "base/win/registry.h" |
55 #endif | 55 #endif |
56 | 56 |
57 class PluginTest : public UITest { | 57 class PluginTest : public UITest { |
58 public: | 58 public: |
59 // Generate the URL for testing a particular test. | 59 // Generate the URL for testing a particular test. |
60 // HTML for the tests is all located in test_directory\plugin\<testcase> | 60 // HTML for the tests is all located in test_directory\plugin\<testcase> |
61 // Set |mock_http| to true to use mock HTTP server. | 61 // Set |mock_http| to true to use mock HTTP server. |
62 static GURL GetTestUrl(const std::string &test_case, bool mock_http) { | 62 static GURL GetTestUrl(const std::string &test_case, bool mock_http) { |
63 static const FilePath::CharType kPluginPath[] = FILE_PATH_LITERAL("plugin"); | 63 static const FilePath::CharType kPluginPath[] = FILE_PATH_LITERAL("plugin"); |
64 if (mock_http) { | 64 if (mock_http) { |
65 FilePath plugin_path = FilePath(kPluginPath).AppendASCII(test_case); | 65 FilePath plugin_path = FilePath(kPluginPath).AppendASCII(test_case); |
66 return URLRequestMockHTTPJob::GetMockUrl(plugin_path); | 66 return URLRequestMockHTTPJob::GetMockUrl(plugin_path); |
67 } | 67 } |
68 | 68 |
69 FilePath path; | 69 FilePath path; |
70 PathService::Get(chrome::DIR_TEST_DATA, &path); | 70 PathService::Get(chrome::DIR_TEST_DATA, &path); |
71 path = path.Append(kPluginPath).AppendASCII(test_case); | 71 path = path.Append(kPluginPath).AppendASCII(test_case); |
72 return net::FilePathToFileURL(path); | 72 return net::FilePathToFileURL(path); |
73 } | 73 } |
74 | 74 |
75 protected: | 75 protected: |
76 #if defined(OS_WIN) | 76 #if defined(OS_WIN) |
77 virtual void SetUp() { | 77 virtual void SetUp() { |
78 const testing::TestInfo* const test_info = | 78 const testing::TestInfo* const test_info = |
79 testing::UnitTest::GetInstance()->current_test_info(); | 79 testing::UnitTest::GetInstance()->current_test_info(); |
80 if (strcmp(test_info->name(), "MediaPlayerNew") == 0) { | 80 if (strcmp(test_info->name(), "MediaPlayerNew") == 0) { |
81 // The installer adds our process names to the registry key below. Since | 81 // The installer adds our process names to the registry key below. Since |
82 // the installer might not have run on this machine, add it manually. | 82 // the installer might not have run on this machine, add it manually. |
83 RegKey regkey; | 83 base::win::RegKey regkey; |
84 if (regkey.Open(HKEY_LOCAL_MACHINE, | 84 if (regkey.Open(HKEY_LOCAL_MACHINE, |
85 L"Software\\Microsoft\\MediaPlayer\\ShimInclusionList", | 85 L"Software\\Microsoft\\MediaPlayer\\ShimInclusionList", |
86 KEY_WRITE)) { | 86 KEY_WRITE)) { |
87 regkey.CreateKey(L"CHROME.EXE", KEY_READ); | 87 regkey.CreateKey(L"CHROME.EXE", KEY_READ); |
88 } | 88 } |
89 } else if (strcmp(test_info->name(), "MediaPlayerOld") == 0) { | 89 } else if (strcmp(test_info->name(), "MediaPlayerOld") == 0) { |
90 // When testing the old WMP plugin, we need to force Chrome to not load | 90 // When testing the old WMP plugin, we need to force Chrome to not load |
91 // the new plugin. | 91 // the new plugin. |
92 launch_arguments_.AppendSwitch(kUseOldWMPPluginSwitch); | 92 launch_arguments_.AppendSwitch(kUseOldWMPPluginSwitch); |
93 } else if (strcmp(test_info->name(), "FlashSecurity") == 0) { | 93 } else if (strcmp(test_info->name(), "FlashSecurity") == 0) { |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 TEST_F(PluginInstallerDownloadTest, PluginInstallerDownloadPathTest) { | 297 TEST_F(PluginInstallerDownloadTest, PluginInstallerDownloadPathTest) { |
298 MessageLoop loop(MessageLoop::TYPE_IO); | 298 MessageLoop loop(MessageLoop::TYPE_IO); |
299 Start(); | 299 Start(); |
300 loop.Run(); | 300 loop.Run(); |
301 | 301 |
302 EXPECT_TRUE(success()); | 302 EXPECT_TRUE(success()); |
303 EXPECT_TRUE(initial_download_path().BaseName().value() == | 303 EXPECT_TRUE(initial_download_path().BaseName().value() == |
304 final_download_path().BaseName().value()); | 304 final_download_path().BaseName().value()); |
305 } | 305 } |
306 #endif // defined(OS_WIN) | 306 #endif // defined(OS_WIN) |
OLD | NEW |