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

Side by Side Diff: content/browser/plugin_browsertest.cc

Issue 10702029: Move tab functions off Browser into browser_tabstrip and browser_tabrestore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/browser_tabstrip.h"
9 #include "chrome/test/base/in_process_browser_test.h" 10 #include "chrome/test/base/in_process_browser_test.h"
10 #include "chrome/test/base/ui_test_utils.h" 11 #include "chrome/test/base/ui_test_utils.h"
11 #include "content/public/browser/browser_thread.h" 12 #include "content/public/browser/browser_thread.h"
12 #include "content/public/common/content_switches.h" 13 #include "content/public/common/content_switches.h"
13 #include "content/test/net/url_request_mock_http_job.h" 14 #include "content/test/net/url_request_mock_http_job.h"
14 #include "webkit/plugins/plugin_switches.h" 15 #include "webkit/plugins/plugin_switches.h"
15 16
16 #if defined(OS_WIN) 17 #if defined(OS_WIN)
17 #include "base/win/registry.h" 18 #include "base/win/registry.h"
18 #endif 19 #endif
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 78
78 virtual void SetUpOnMainThread() OVERRIDE { 79 virtual void SetUpOnMainThread() OVERRIDE {
79 FilePath path = ui_test_utils::GetTestFilePath(FilePath(), FilePath()); 80 FilePath path = ui_test_utils::GetTestFilePath(FilePath(), FilePath());
80 BrowserThread::PostTask( 81 BrowserThread::PostTask(
81 BrowserThread::IO, FROM_HERE, base::Bind(&SetUrlRequestMock, path)); 82 BrowserThread::IO, FROM_HERE, base::Bind(&SetUrlRequestMock, path));
82 } 83 }
83 84
84 void LoadAndWait(const GURL& url) { 85 void LoadAndWait(const GURL& url) {
85 string16 expected_title(ASCIIToUTF16("OK")); 86 string16 expected_title(ASCIIToUTF16("OK"));
86 ui_test_utils::TitleWatcher title_watcher( 87 ui_test_utils::TitleWatcher title_watcher(
87 browser()->GetActiveWebContents(), expected_title); 88 chrome::GetActiveWebContents(browser()), expected_title);
88 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); 89 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
89 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("plugin_not_found")); 90 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("plugin_not_found"));
90 ui_test_utils::NavigateToURL(browser(), url); 91 ui_test_utils::NavigateToURL(browser(), url);
91 string16 title = title_watcher.WaitAndGetTitle(); 92 string16 title = title_watcher.WaitAndGetTitle();
92 if (title == ASCIIToUTF16("plugin_not_found")) { 93 if (title == ASCIIToUTF16("plugin_not_found")) {
93 const testing::TestInfo* const test_info = 94 const testing::TestInfo* const test_info =
94 testing::UnitTest::GetInstance()->current_test_info(); 95 testing::UnitTest::GetInstance()->current_test_info();
95 LOG(INFO) << "PluginTest." << test_info->name() << 96 LOG(INFO) << "PluginTest." << test_info->name() <<
96 " not running because plugin not installed."; 97 " not running because plugin not installed.";
97 } else { 98 } else {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 // This was never ported to Mac. The only thing remaining is to make 169 // This was never ported to Mac. The only thing remaining is to make
169 // ui_test_utils::SimulateMouseClick get to Mac plugins, currently it doesn't 170 // ui_test_utils::SimulateMouseClick get to Mac plugins, currently it doesn't
170 // work. 171 // work.
171 IN_PROC_BROWSER_TEST_F(PluginTest, 172 IN_PROC_BROWSER_TEST_F(PluginTest,
172 SelfDeletePluginInvokeInSynchronousMouseUp) { 173 SelfDeletePluginInvokeInSynchronousMouseUp) {
173 ui_test_utils::NavigateToURL( 174 ui_test_utils::NavigateToURL(
174 browser(), GetURL("execute_script_delete_in_mouse_up.html")); 175 browser(), GetURL("execute_script_delete_in_mouse_up.html"));
175 176
176 string16 expected_title(ASCIIToUTF16("OK")); 177 string16 expected_title(ASCIIToUTF16("OK"));
177 ui_test_utils::TitleWatcher title_watcher( 178 ui_test_utils::TitleWatcher title_watcher(
178 browser()->GetActiveWebContents(), expected_title); 179 chrome::GetActiveWebContents(browser()), expected_title);
179 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); 180 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
180 ui_test_utils::SimulateMouseClick(browser()->GetActiveWebContents()); 181 ui_test_utils::SimulateMouseClick(chrome::GetActiveWebContents(browser()));
181 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); 182 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
182 } 183 }
183 #endif 184 #endif
184 185
185 // Flaky, http://crbug.com/60071. 186 // Flaky, http://crbug.com/60071.
186 IN_PROC_BROWSER_TEST_F(PluginTest, GetURLRequest404Response) { 187 IN_PROC_BROWSER_TEST_F(PluginTest, GetURLRequest404Response) {
187 GURL url(URLRequestMockHTTPJob::GetMockUrl( 188 GURL url(URLRequestMockHTTPJob::GetMockUrl(
188 FilePath().AppendASCII("npapi"). 189 FilePath().AppendASCII("npapi").
189 AppendASCII("plugin_url_request_404.html"))); 190 AppendASCII("plugin_url_request_404.html")));
190 LoadAndWait(url); 191 LoadAndWait(url);
191 } 192 }
192 193
193 // Tests if a plugin executing a self deleting script using Invoke with 194 // Tests if a plugin executing a self deleting script using Invoke with
194 // a modal dialog showing works without crashing or hanging 195 // a modal dialog showing works without crashing or hanging
195 // Disabled, flakily exceeds timeout, http://crbug.com/46257. 196 // Disabled, flakily exceeds timeout, http://crbug.com/46257.
196 IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeletePluginInvokeAlert) { 197 IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeletePluginInvokeAlert) {
197 // Navigate asynchronously because if we waitd until it completes, there's a 198 // Navigate asynchronously because if we waitd until it completes, there's a
198 // race condition where the alert can come up before we start watching for it. 199 // race condition where the alert can come up before we start watching for it.
199 ui_test_utils::NavigateToURLWithDisposition( 200 ui_test_utils::NavigateToURLWithDisposition(
200 browser(), GetURL("self_delete_plugin_invoke_alert.html"), CURRENT_TAB, 201 browser(), GetURL("self_delete_plugin_invoke_alert.html"), CURRENT_TAB,
201 0); 202 0);
202 203
203 string16 expected_title(ASCIIToUTF16("OK")); 204 string16 expected_title(ASCIIToUTF16("OK"));
204 ui_test_utils::TitleWatcher title_watcher( 205 ui_test_utils::TitleWatcher title_watcher(
205 browser()->GetActiveWebContents(), expected_title); 206 chrome::GetActiveWebContents(browser()), expected_title);
206 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); 207 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
207 208
208 ui_test_utils::WaitForAppModalDialogAndCloseIt(); 209 ui_test_utils::WaitForAppModalDialogAndCloseIt();
209 210
210 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); 211 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
211 } 212 }
212 213
213 // Test passing arguments to a plugin. 214 // Test passing arguments to a plugin.
214 IN_PROC_BROWSER_TEST_F(PluginTest, Arguments) { 215 IN_PROC_BROWSER_TEST_F(PluginTest, Arguments) {
215 LoadAndWait(GetURL("arguments.html")); 216 LoadAndWait(GetURL("arguments.html"));
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 IN_PROC_BROWSER_TEST_F(PluginTest, DISABLED_PluginConvertPointTest) { 394 IN_PROC_BROWSER_TEST_F(PluginTest, DISABLED_PluginConvertPointTest) {
394 gfx::NativeWindow window = NULL; 395 gfx::NativeWindow window = NULL;
395 gfx::Rect bounds(50, 50, 400, 400); 396 gfx::Rect bounds(50, 50, 400, 400);
396 ui_test_utils::GetNativeWindow(browser(), &window); 397 ui_test_utils::GetNativeWindow(browser(), &window);
397 ui_test_utils::SetWindowBounds(window, bounds); 398 ui_test_utils::SetWindowBounds(window, bounds);
398 399
399 ui_test_utils::NavigateToURL(browser(), GetURL("convert_point.html")); 400 ui_test_utils::NavigateToURL(browser(), GetURL("convert_point.html"));
400 401
401 string16 expected_title(ASCIIToUTF16("OK")); 402 string16 expected_title(ASCIIToUTF16("OK"));
402 ui_test_utils::TitleWatcher title_watcher( 403 ui_test_utils::TitleWatcher title_watcher(
403 browser()->GetActiveWebContents(), expected_title); 404 chrome::GetActiveWebContents(browser()), expected_title);
404 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); 405 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
405 // TODO(stuartmorgan): When the automation system supports sending clicks, 406 // TODO(stuartmorgan): When the automation system supports sending clicks,
406 // change the test to trigger on mouse-down rather than window focus. 407 // change the test to trigger on mouse-down rather than window focus.
407 static_cast<content::WebContentsDelegate*>(browser())-> 408 static_cast<content::WebContentsDelegate*>(browser())->
408 ActivateContents(browser()->GetActiveWebContents()); 409 ActivateContents(chrome::GetActiveWebContents(browser()));
409 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); 410 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
410 } 411 }
411 #endif 412 #endif
412 413
413 IN_PROC_BROWSER_TEST_F(PluginTest, Flash) { 414 IN_PROC_BROWSER_TEST_F(PluginTest, Flash) {
414 TestPlugin("flash.html"); 415 TestPlugin("flash.html");
415 } 416 }
416 417
417 #if defined(OS_WIN) 418 #if defined(OS_WIN)
418 // Windows only test 419 // Windows only test
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 460
460 // http://crbug.com/8690 461 // http://crbug.com/8690
461 IN_PROC_BROWSER_TEST_F(PluginTest, DISABLED_Java) { 462 IN_PROC_BROWSER_TEST_F(PluginTest, DISABLED_Java) {
462 TestPlugin("Java.html"); 463 TestPlugin("Java.html");
463 } 464 }
464 465
465 IN_PROC_BROWSER_TEST_F(PluginTest, Silverlight) { 466 IN_PROC_BROWSER_TEST_F(PluginTest, Silverlight) {
466 TestPlugin("silverlight.html"); 467 TestPlugin("silverlight.html");
467 } 468 }
468 #endif // defined(OS_WIN) 469 #endif // defined(OS_WIN)
OLDNEW
« no previous file with comments | « content/browser/mouseleave_browsertest.cc ('k') | content/browser/renderer_host/render_process_host_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698