| OLD | NEW |
| 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 #include "chrome/browser/ui/webui/web_ui_browsertest.h" | 4 #include "chrome/browser/ui/webui/web_ui_browsertest.h" |
| 5 | 5 |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 browser::NavigateParams params( | 176 browser::NavigateParams params( |
| 177 browser(), GURL(browse_to), PageTransition::TYPED); | 177 browser(), GURL(browse_to), PageTransition::TYPED); |
| 178 params.disposition = CURRENT_TAB; | 178 params.disposition = CURRENT_TAB; |
| 179 browser::Navigate(¶ms); | 179 browser::Navigate(¶ms); |
| 180 navigation_observer.WaitForObservation(); | 180 navigation_observer.WaitForObservation(); |
| 181 } | 181 } |
| 182 | 182 |
| 183 void WebUIBrowserTest::BrowsePrintPreload( | 183 void WebUIBrowserTest::BrowsePrintPreload( |
| 184 const GURL& browse_to, | 184 const GURL& browse_to, |
| 185 const std::string& preload_test_fixture, | 185 const std::string& preload_test_fixture, |
| 186 const std::string& preload_test_name) { | 186 const std::string& preload_test_name, |
| 187 bool no_print) { |
| 187 // Remember for callback OnJsInjectionReady(). | 188 // Remember for callback OnJsInjectionReady(). |
| 188 preload_test_fixture_ = preload_test_fixture; | 189 preload_test_fixture_ = preload_test_fixture; |
| 189 preload_test_name_ = preload_test_name; | 190 preload_test_name_ = preload_test_name; |
| 190 | 191 |
| 192 TestTabStripModelObserver tabstrip_observer( |
| 193 browser()->tabstrip_model(), this); |
| 194 |
| 191 ui_test_utils::NavigateToURL(browser(), browse_to); | 195 ui_test_utils::NavigateToURL(browser(), browse_to); |
| 192 | 196 |
| 193 TestTabStripModelObserver tabstrip_observer( | 197 if (!no_print) |
| 194 browser()->tabstrip_model(), this); | 198 browser()->Print(); |
| 195 browser()->Print(); | 199 |
| 196 tabstrip_observer.WaitForObservation(); | 200 tabstrip_observer.WaitForObservation(); |
| 197 } | 201 } |
| 198 | 202 |
| 199 WebUIBrowserTest::WebUIBrowserTest() | 203 WebUIBrowserTest::WebUIBrowserTest() |
| 200 : test_handler_(new WebUITestHandler()), | 204 : test_handler_(new WebUITestHandler()), |
| 201 libraries_preloaded_(false) {} | 205 libraries_preloaded_(false) {} |
| 202 | 206 |
| 203 void WebUIBrowserTest::SetUpInProcessBrowserTestFixture() { | 207 void WebUIBrowserTest::SetUpInProcessBrowserTestFixture() { |
| 204 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory_)); | 208 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory_)); |
| 205 test_data_directory_ = test_data_directory_.Append(kWebUITestFolder); | 209 test_data_directory_ = test_data_directory_.Append(kWebUITestFolder); |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 // testDone directly and expect pass result. | 581 // testDone directly and expect pass result. |
| 578 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPassesAsync) { | 582 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPassesAsync) { |
| 579 ASSERT_TRUE(RunJavascriptAsyncTest("testDone")); | 583 ASSERT_TRUE(RunJavascriptAsyncTest("testDone")); |
| 580 } | 584 } |
| 581 | 585 |
| 582 // Test that calling testDone during RunJavascriptTest still completes when | 586 // Test that calling testDone during RunJavascriptTest still completes when |
| 583 // waiting for async result. | 587 // waiting for async result. |
| 584 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPasses) { | 588 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPasses) { |
| 585 ASSERT_TRUE(RunJavascriptTest("testDone")); | 589 ASSERT_TRUE(RunJavascriptTest("testDone")); |
| 586 } | 590 } |
| OLD | NEW |