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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 base::Bind(&ui_test_utils::RunMessageLoop), | 202 base::Bind(&ui_test_utils::RunMessageLoop), |
203 base::Bind(&MessageLoop::Quit, | 203 base::Bind(&MessageLoop::Quit, |
204 base::Unretained(MessageLoopForUI::current()))); | 204 base::Unretained(MessageLoopForUI::current()))); |
205 | 205 |
206 printing::PrintPreviewTabController* tab_controller = | 206 printing::PrintPreviewTabController* tab_controller = |
207 printing::PrintPreviewTabController::GetInstance(); | 207 printing::PrintPreviewTabController::GetInstance(); |
208 ASSERT_TRUE(tab_controller); | 208 ASSERT_TRUE(tab_controller); |
209 TabContentsWrapper* preview_tab = tab_controller->GetPrintPreviewForTab( | 209 TabContentsWrapper* preview_tab = tab_controller->GetPrintPreviewForTab( |
210 browser()->GetSelectedTabContentsWrapper()); | 210 browser()->GetSelectedTabContentsWrapper()); |
211 ASSERT_TRUE(preview_tab); | 211 ASSERT_TRUE(preview_tab); |
212 SetWebUIInstance(preview_tab->tab_contents()->web_ui()); | 212 SetWebUIInstance(preview_tab->tab_contents()->GetWebUI()); |
213 } | 213 } |
214 | 214 |
215 const char WebUIBrowserTest::kDummyURL[] = "chrome://DummyURL"; | 215 const char WebUIBrowserTest::kDummyURL[] = "chrome://DummyURL"; |
216 | 216 |
217 WebUIBrowserTest::WebUIBrowserTest() | 217 WebUIBrowserTest::WebUIBrowserTest() |
218 : test_handler_(new WebUITestHandler()), | 218 : test_handler_(new WebUITestHandler()), |
219 libraries_preloaded_(false), | 219 libraries_preloaded_(false), |
220 override_selected_web_ui_(NULL) {} | 220 override_selected_web_ui_(NULL) {} |
221 | 221 |
222 void WebUIBrowserTest::set_preload_test_fixture( | 222 void WebUIBrowserTest::set_preload_test_fixture( |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 LOG(ERROR) << "Encountered javascript console error(s)"; | 398 LOG(ERROR) << "Encountered javascript console error(s)"; |
399 result = false; | 399 result = false; |
400 error_messages_.Get().clear(); | 400 error_messages_.Get().clear(); |
401 } | 401 } |
402 return result; | 402 return result; |
403 } | 403 } |
404 | 404 |
405 void WebUIBrowserTest::SetupHandlers() { | 405 void WebUIBrowserTest::SetupHandlers() { |
406 WebUI* web_ui_instance = override_selected_web_ui_ ? | 406 WebUI* web_ui_instance = override_selected_web_ui_ ? |
407 override_selected_web_ui_ : | 407 override_selected_web_ui_ : |
408 browser()->GetSelectedTabContents()->web_ui(); | 408 browser()->GetSelectedTabContents()->GetWebUI(); |
409 ASSERT_TRUE(web_ui_instance != NULL); | 409 ASSERT_TRUE(web_ui_instance != NULL); |
410 web_ui_instance->set_register_callback_overwrites(true); | 410 web_ui_instance->set_register_callback_overwrites(true); |
411 test_handler_->Attach(web_ui_instance); | 411 test_handler_->Attach(web_ui_instance); |
412 | 412 |
413 if (GetMockMessageHandler()) | 413 if (GetMockMessageHandler()) |
414 GetMockMessageHandler()->Attach(web_ui_instance); | 414 GetMockMessageHandler()->Attach(web_ui_instance); |
415 } | 415 } |
416 | 416 |
417 // According to the interface for EXPECT_FATAL_FAILURE | 417 // According to the interface for EXPECT_FATAL_FAILURE |
418 // (http://code.google.com/p/googletest/wiki/AdvancedGuide#Catching_Failures) | 418 // (http://code.google.com/p/googletest/wiki/AdvancedGuide#Catching_Failures) |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 // testDone directly and expect pass result. | 634 // testDone directly and expect pass result. |
635 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPassesAsync) { | 635 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPassesAsync) { |
636 ASSERT_TRUE(RunJavascriptAsyncTest("testDone")); | 636 ASSERT_TRUE(RunJavascriptAsyncTest("testDone")); |
637 } | 637 } |
638 | 638 |
639 // Test that calling testDone during RunJavascriptTest still completes when | 639 // Test that calling testDone during RunJavascriptTest still completes when |
640 // waiting for async result. | 640 // waiting for async result. |
641 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPasses) { | 641 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPasses) { |
642 ASSERT_TRUE(RunJavascriptTest("testDone")); | 642 ASSERT_TRUE(RunJavascriptTest("testDone")); |
643 } | 643 } |
OLD | NEW |