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

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

Issue 6365003: Tolerate out-of-date plugins for these particular tests, otherwise they... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 return URLRequestMockHTTPJob::GetMockUrl(plugin_path); 68 return URLRequestMockHTTPJob::GetMockUrl(plugin_path);
69 } 69 }
70 70
71 FilePath path; 71 FilePath path;
72 PathService::Get(chrome::DIR_TEST_DATA, &path); 72 PathService::Get(chrome::DIR_TEST_DATA, &path);
73 path = path.Append(kPluginPath).AppendASCII(test_case); 73 path = path.Append(kPluginPath).AppendASCII(test_case);
74 return net::FilePathToFileURL(path); 74 return net::FilePathToFileURL(path);
75 } 75 }
76 76
77 protected: 77 protected:
78 virtual void SetUp() {
78 #if defined(OS_WIN) 79 #if defined(OS_WIN)
79 virtual void SetUp() {
80 const testing::TestInfo* const test_info = 80 const testing::TestInfo* const test_info =
81 testing::UnitTest::GetInstance()->current_test_info(); 81 testing::UnitTest::GetInstance()->current_test_info();
82 if (strcmp(test_info->name(), "MediaPlayerNew") == 0) { 82 if (strcmp(test_info->name(), "MediaPlayerNew") == 0) {
83 // The installer adds our process names to the registry key below. Since 83 // The installer adds our process names to the registry key below. Since
84 // the installer might not have run on this machine, add it manually. 84 // the installer might not have run on this machine, add it manually.
85 base::win::RegKey regkey; 85 base::win::RegKey regkey;
86 if (regkey.Open(HKEY_LOCAL_MACHINE, 86 if (regkey.Open(HKEY_LOCAL_MACHINE,
87 L"Software\\Microsoft\\MediaPlayer\\ShimInclusionList", 87 L"Software\\Microsoft\\MediaPlayer\\ShimInclusionList",
88 KEY_WRITE)) { 88 KEY_WRITE)) {
89 regkey.CreateKey(L"CHROME.EXE", KEY_READ); 89 regkey.CreateKey(L"CHROME.EXE", KEY_READ);
90 } 90 }
91 } else if (strcmp(test_info->name(), "MediaPlayerOld") == 0) { 91 } else if (strcmp(test_info->name(), "MediaPlayerOld") == 0) {
92 // When testing the old WMP plugin, we need to force Chrome to not load 92 // When testing the old WMP plugin, we need to force Chrome to not load
93 // the new plugin. 93 // the new plugin.
94 launch_arguments_.AppendSwitch(switches::kUseOldWMPPlugin); 94 launch_arguments_.AppendSwitch(switches::kUseOldWMPPlugin);
95 } else if (strcmp(test_info->name(), "FlashSecurity") == 0) { 95 } else if (strcmp(test_info->name(), "FlashSecurity") == 0) {
96 launch_arguments_.AppendSwitchASCII(switches::kTestSandbox, 96 launch_arguments_.AppendSwitchASCII(switches::kTestSandbox,
97 "security_tests.dll"); 97 "security_tests.dll");
98 } 98 }
99 #endif // defined(OS_WIN)
100
101 launch_arguments_.AppendSwitch(switches::kAllowOutdatedPlugins);
99 102
100 UITest::SetUp(); 103 UITest::SetUp();
101 } 104 }
102 #endif // defined(OS_WIN)
103 105
104 void TestPlugin(const std::string& test_case, 106 void TestPlugin(const std::string& test_case,
105 int timeout, 107 int timeout,
106 bool mock_http) { 108 bool mock_http) {
107 GURL url = GetTestUrl(test_case, mock_http); 109 GURL url = GetTestUrl(test_case, mock_http);
108 NavigateToURL(url); 110 NavigateToURL(url);
109 WaitForFinish(timeout, mock_http); 111 WaitForFinish(timeout, mock_http);
110 } 112 }
111 113
112 // Waits for the test case to finish. 114 // Waits for the test case to finish.
113 void WaitForFinish(const int wait_time, bool mock_http) { 115 void WaitForFinish(const int wait_time, bool mock_http) {
114 static const char kTestCompleteCookie[] = "status"; 116 static const char kTestCompleteCookie[] = "status";
115 static const char kTestCompleteSuccess[] = "OK"; 117 static const char kTestCompleteSuccess[] = "OK";
116 118
117 GURL url = GetTestUrl("done", mock_http); 119 GURL url = GetTestUrl("done", mock_http);
118 scoped_refptr<TabProxy> tab(GetActiveTab()); 120 scoped_refptr<TabProxy> tab(GetActiveTab());
119 121
120 const std::string result = 122 const std::string result =
121 WaitUntilCookieNonEmpty(tab, url, kTestCompleteCookie, wait_time); 123 WaitUntilCookieNonEmpty(tab, url, kTestCompleteCookie, wait_time);
122 ASSERT_EQ(kTestCompleteSuccess, result); 124 ASSERT_EQ(kTestCompleteSuccess, result);
123 } 125 }
124 }; 126 };
125 127
126 // http://crbug.com/68303 128 // http://crbug.com/68751
127 #if defined(OS_MACOSX) || defined(OS_LINUX) 129 #if defined(OS_MACOSX)
128 TEST_F(PluginTest, DISABLED_Flash) { 130 TEST_F(PluginTest, DISABLED_Flash) {
129 #else 131 #else
130 TEST_F(PluginTest, Flash) { 132 TEST_F(PluginTest, Flash) {
131 #endif 133 #endif
132 // Note: This does not work with the npwrapper on 64-bit Linux. Install the 134 // Note: This does not work with the npwrapper on 64-bit Linux. Install the
133 // native 64-bit Flash to run the test. 135 // native 64-bit Flash to run the test.
134 // TODO(thestig) Update this list if we decide to only test against internal 136 // TODO(thestig) Update this list if we decide to only test against internal
135 // Flash plugin in the future? 137 // Flash plugin in the future?
136 std::string kFlashQuery = 138 std::string kFlashQuery =
137 #if defined(OS_WIN) 139 #if defined(OS_WIN)
138 "npswf32.dll" 140 "npswf32.dll"
139 #elif defined(OS_MACOSX) 141 #elif defined(OS_MACOSX)
140 "Flash Player.plugin" 142 "Flash Player.plugin"
141 #elif defined(OS_POSIX) 143 #elif defined(OS_POSIX)
142 "libflashplayer.so" 144 "libflashplayer.so"
143 #endif 145 #endif
144 ; 146 ;
145 TestPlugin("flash.html?" + kFlashQuery, action_max_timeout_ms(), false); 147 TestPlugin("flash.html?" + kFlashQuery, action_max_timeout_ms(), false);
146 } 148 }
147 149
148 class ClickToPlayPluginTest : public PluginTest { 150 class ClickToPlayPluginTest : public PluginTest {
149 public: 151 public:
150 ClickToPlayPluginTest() { 152 ClickToPlayPluginTest() {
151 dom_automation_enabled_ = true; 153 dom_automation_enabled_ = true;
152 } 154 }
153 }; 155 };
154 156
155 // http://crbug.com/68303 157 // http://crbug.com/68751
156 #if defined(OS_MACOSX) 158 #if defined(OS_MACOSX)
157 TEST_F(ClickToPlayPluginTest, DISABLED_Flash) { 159 TEST_F(ClickToPlayPluginTest, DISABLED_Flash) {
158 #else 160 #else
159 TEST_F(ClickToPlayPluginTest, Flash) { 161 TEST_F(ClickToPlayPluginTest, Flash) {
160 #endif 162 #endif
161 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); 163 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
162 ASSERT_TRUE(browser.get()); 164 ASSERT_TRUE(browser.get());
163 ASSERT_TRUE(browser->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, 165 ASSERT_TRUE(browser->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS,
164 CONTENT_SETTING_BLOCK)); 166 CONTENT_SETTING_BLOCK));
165 167
166 GURL url = GetTestUrl("flash-clicktoplay.html", true); 168 GURL url = GetTestUrl("flash-clicktoplay.html", true);
167 NavigateToURL(url); 169 NavigateToURL(url);
168 170
169 scoped_refptr<TabProxy> tab(browser->GetTab(0)); 171 scoped_refptr<TabProxy> tab(browser->GetTab(0));
170 ASSERT_TRUE(tab.get()); 172 ASSERT_TRUE(tab.get());
171 173
172 ASSERT_TRUE(tab->LoadBlockedPlugins()); 174 ASSERT_TRUE(tab->LoadBlockedPlugins());
173 175
174 WaitForFinish(action_max_timeout_ms(), true); 176 WaitForFinish(action_max_timeout_ms(), true);
175 } 177 }
176 178
177 // http://crbug.com/68303 179 // http://crbug.com/68751
Bernhard Bauer 2011/01/19 07:57:38 Drive-by: http://crbug.com/68751 is marked as fixe
178 #if defined(OS_MACOSX) 180 #if defined(OS_MACOSX)
179 TEST_F(ClickToPlayPluginTest, DISABLED_FlashDocument) { 181 TEST_F(ClickToPlayPluginTest, DISABLED_FlashDocument) {
180 #else 182 #else
181 TEST_F(ClickToPlayPluginTest, FlashDocument) { 183 TEST_F(ClickToPlayPluginTest, FlashDocument) {
182 #endif 184 #endif
183 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); 185 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
184 ASSERT_TRUE(browser.get()); 186 ASSERT_TRUE(browser.get());
185 ASSERT_TRUE(browser->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, 187 ASSERT_TRUE(browser->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS,
186 CONTENT_SETTING_BLOCK)); 188 CONTENT_SETTING_BLOCK));
187 189
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 TEST_F(PluginInstallerDownloadTest, PluginInstallerDownloadPathTest) { 363 TEST_F(PluginInstallerDownloadTest, PluginInstallerDownloadPathTest) {
362 MessageLoop loop(MessageLoop::TYPE_IO); 364 MessageLoop loop(MessageLoop::TYPE_IO);
363 Start(); 365 Start();
364 loop.Run(); 366 loop.Run();
365 367
366 EXPECT_TRUE(success()); 368 EXPECT_TRUE(success());
367 EXPECT_TRUE(initial_download_path().BaseName().value() == 369 EXPECT_TRUE(initial_download_path().BaseName().value() ==
368 final_download_path().BaseName().value()); 370 final_download_path().BaseName().value());
369 } 371 }
370 #endif // defined(OS_WIN) 372 #endif // defined(OS_WIN)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698