OLD | NEW |
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 "chrome/browser/ui/webui/web_ui_browsertest.h" | 5 #include "chrome/browser/ui/webui/web_ui_browsertest.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 void WebUIBrowserTest::BrowsePreload(const GURL& browse_to) { | 198 void WebUIBrowserTest::BrowsePreload(const GURL& browse_to) { |
199 content::TestNavigationObserver navigation_observer( | 199 content::TestNavigationObserver navigation_observer( |
200 content::Source<NavigationController>( | 200 content::Source<NavigationController>( |
201 &chrome::GetActiveWebContents(browser())->GetController()), | 201 &chrome::GetActiveWebContents(browser())->GetController()), |
202 this, 1); | 202 this, 1); |
203 chrome::NavigateParams params(browser(), GURL(browse_to), | 203 chrome::NavigateParams params(browser(), GURL(browse_to), |
204 content::PAGE_TRANSITION_TYPED); | 204 content::PAGE_TRANSITION_TYPED); |
205 params.disposition = CURRENT_TAB; | 205 params.disposition = CURRENT_TAB; |
206 chrome::Navigate(¶ms); | 206 chrome::Navigate(¶ms); |
207 navigation_observer.WaitForObservation( | 207 navigation_observer.WaitForObservation( |
208 base::Bind(&ui_test_utils::RunMessageLoop), | 208 base::Bind(&content::RunMessageLoop), |
209 base::Bind(&MessageLoop::Quit, | 209 base::Bind(&MessageLoop::Quit, |
210 base::Unretained(MessageLoopForUI::current()))); | 210 base::Unretained(MessageLoopForUI::current()))); |
211 } | 211 } |
212 | 212 |
213 void WebUIBrowserTest::BrowsePrintPreload(const GURL& browse_to) { | 213 void WebUIBrowserTest::BrowsePrintPreload(const GURL& browse_to) { |
214 ui_test_utils::NavigateToURL(browser(), browse_to); | 214 ui_test_utils::NavigateToURL(browser(), browse_to); |
215 | 215 |
216 TestTabStripModelObserver tabstrip_observer( | 216 TestTabStripModelObserver tabstrip_observer( |
217 browser()->tab_strip_model(), this); | 217 browser()->tab_strip_model(), this); |
218 chrome::Print(browser()); | 218 chrome::Print(browser()); |
219 tabstrip_observer.WaitForObservation( | 219 tabstrip_observer.WaitForObservation( |
220 base::Bind(&ui_test_utils::RunMessageLoop), | 220 base::Bind(&content::RunMessageLoop), |
221 base::Bind(&MessageLoop::Quit, | 221 base::Bind(&MessageLoop::Quit, |
222 base::Unretained(MessageLoopForUI::current()))); | 222 base::Unretained(MessageLoopForUI::current()))); |
223 | 223 |
224 printing::PrintPreviewTabController* tab_controller = | 224 printing::PrintPreviewTabController* tab_controller = |
225 printing::PrintPreviewTabController::GetInstance(); | 225 printing::PrintPreviewTabController::GetInstance(); |
226 ASSERT_TRUE(tab_controller); | 226 ASSERT_TRUE(tab_controller); |
227 TabContents* preview_tab = tab_controller->GetPrintPreviewForTab( | 227 TabContents* preview_tab = tab_controller->GetPrintPreviewForTab( |
228 chrome::GetActiveTabContents(browser())); | 228 chrome::GetActiveTabContents(browser())); |
229 ASSERT_TRUE(preview_tab); | 229 ASSERT_TRUE(preview_tab); |
230 SetWebUIInstance(preview_tab->web_contents()->GetWebUI()); | 230 SetWebUIInstance(preview_tab->web_contents()->GetWebUI()); |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 // testDone directly and expect pass result. | 698 // testDone directly and expect pass result. |
699 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPassesAsync) { | 699 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPassesAsync) { |
700 ASSERT_TRUE(RunJavascriptAsyncTest("testDone")); | 700 ASSERT_TRUE(RunJavascriptAsyncTest("testDone")); |
701 } | 701 } |
702 | 702 |
703 // Test that calling testDone during RunJavascriptTest still completes when | 703 // Test that calling testDone during RunJavascriptTest still completes when |
704 // waiting for async result. | 704 // waiting for async result. |
705 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPasses) { | 705 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPasses) { |
706 ASSERT_TRUE(RunJavascriptTest("testDone")); | 706 ASSERT_TRUE(RunJavascriptTest("testDone")); |
707 } | 707 } |
OLD | NEW |