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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 preload_test_name_ = preload_test_name; | 149 preload_test_name_ = preload_test_name; |
150 | 150 |
151 ui_test_utils::NavigateToURL(browser(), browse_to); | 151 ui_test_utils::NavigateToURL(browser(), browse_to); |
152 | 152 |
153 TestTabStripModelObserver tabstrip_observer( | 153 TestTabStripModelObserver tabstrip_observer( |
154 browser()->tabstrip_model(), this); | 154 browser()->tabstrip_model(), this); |
155 browser()->Print(); | 155 browser()->Print(); |
156 tabstrip_observer.WaitForObservation(); | 156 tabstrip_observer.WaitForObservation(); |
157 } | 157 } |
158 | 158 |
| 159 bool WebUIBrowserTest::WaitForAsyncResult() { |
| 160 return test_handler_->WaitForAsyncResult(); |
| 161 } |
| 162 |
159 WebUIBrowserTest::WebUIBrowserTest() | 163 WebUIBrowserTest::WebUIBrowserTest() |
160 : test_handler_(new WebUITestHandler()), | 164 : test_handler_(new WebUITestHandler()), |
161 libraries_preloaded_(false) {} | 165 libraries_preloaded_(false) {} |
162 | 166 |
163 void WebUIBrowserTest::SetUpInProcessBrowserTestFixture() { | 167 void WebUIBrowserTest::SetUpInProcessBrowserTestFixture() { |
164 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory_)); | 168 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory_)); |
165 test_data_directory_ = test_data_directory_.Append(kWebUITestFolder); | 169 test_data_directory_ = test_data_directory_.Append(kWebUITestFolder); |
166 | 170 |
167 // TODO(dtseng): should this be part of every BrowserTest or just WebUI test. | 171 // TODO(dtseng): should this be part of every BrowserTest or just WebUI test. |
168 FilePath resources_pack_path; | 172 FilePath resources_pack_path; |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 }; | 324 }; |
321 | 325 |
322 WebUIBrowserTest* WebUIBrowserExpectFailTest::s_test_ = NULL; | 326 WebUIBrowserTest* WebUIBrowserExpectFailTest::s_test_ = NULL; |
323 | 327 |
324 IN_PROC_BROWSER_TEST_F(WebUIBrowserExpectFailTest, TestFailsFast) { | 328 IN_PROC_BROWSER_TEST_F(WebUIBrowserExpectFailTest, TestFailsFast) { |
325 AddLibrary(FilePath(FILE_PATH_LITERAL("sample_downloads.js"))); | 329 AddLibrary(FilePath(FILE_PATH_LITERAL("sample_downloads.js"))); |
326 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIDownloadsURL)); | 330 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIDownloadsURL)); |
327 EXPECT_FATAL_FAILURE(RunJavascriptTestNoReturn("FAILS_BogusFunctionName"), | 331 EXPECT_FATAL_FAILURE(RunJavascriptTestNoReturn("FAILS_BogusFunctionName"), |
328 "WebUITestHandler::Observe"); | 332 "WebUITestHandler::Observe"); |
329 } | 333 } |
OLD | NEW |