| 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" |
| 11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/printing/print_preview_tab_controller.h" | 15 #include "chrome/browser/printing/print_preview_tab_controller.h" |
| 16 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
| 17 #include "chrome/browser/ui/browser_navigator.h" | 17 #include "chrome/browser/ui/browser_navigator.h" |
| 18 #include "chrome/browser/ui/webui/chrome_web_ui.h" | 18 #include "chrome/browser/ui/webui/chrome_web_ui.h" |
| 19 #include "chrome/browser/ui/webui/test_chrome_web_ui_factory.h" | 19 #include "chrome/browser/ui/webui/test_chrome_web_ui_factory.h" |
| 20 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 20 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 21 #include "chrome/common/chrome_paths.h" | 21 #include "chrome/common/chrome_paths.h" |
| 22 #include "chrome/common/url_constants.h" | 22 #include "chrome/common/url_constants.h" |
| 23 #include "chrome/test/base/test_tab_strip_model_observer.h" | 23 #include "chrome/test/base/test_tab_strip_model_observer.h" |
| 24 #include "chrome/test/base/ui_test_utils.h" | 24 #include "chrome/test/base/ui_test_utils.h" |
| 25 #include "content/browser/tab_contents/tab_contents.h" | 25 #include "content/browser/tab_contents/tab_contents.h" |
| 26 #include "content/public/browser/web_ui_message_handler.h" |
| 26 #include "testing/gmock/include/gmock/gmock.h" | 27 #include "testing/gmock/include/gmock/gmock.h" |
| 27 #include "testing/gtest/include/gtest/gtest-spi.h" | 28 #include "testing/gtest/include/gtest/gtest-spi.h" |
| 28 #include "ui/base/resource/resource_bundle.h" | 29 #include "ui/base/resource/resource_bundle.h" |
| 29 | 30 |
| 30 using content::WebContents; | 31 using content::WebContents; |
| 32 using content::WebUIMessageHandler; |
| 31 | 33 |
| 32 namespace { | 34 namespace { |
| 33 | 35 |
| 34 const FilePath::CharType kMockJS[] = FILE_PATH_LITERAL("mock4js.js"); | 36 const FilePath::CharType kMockJS[] = FILE_PATH_LITERAL("mock4js.js"); |
| 35 const FilePath::CharType kWebUILibraryJS[] = FILE_PATH_LITERAL("test_api.js"); | 37 const FilePath::CharType kWebUILibraryJS[] = FILE_PATH_LITERAL("test_api.js"); |
| 36 const FilePath::CharType kWebUITestFolder[] = FILE_PATH_LITERAL("webui"); | 38 const FilePath::CharType kWebUITestFolder[] = FILE_PATH_LITERAL("webui"); |
| 37 base::LazyInstance<std::vector<std::string> > error_messages_ = | 39 base::LazyInstance<std::vector<std::string> > error_messages_ = |
| 38 LAZY_INSTANCE_INITIALIZER; | 40 LAZY_INSTANCE_INITIALIZER; |
| 39 | 41 |
| 40 // Intercepts all log messages. | 42 // Intercepts all log messages. |
| (...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 // testDone directly and expect pass result. | 641 // testDone directly and expect pass result. |
| 640 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPassesAsync) { | 642 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPassesAsync) { |
| 641 ASSERT_TRUE(RunJavascriptAsyncTest("testDone")); | 643 ASSERT_TRUE(RunJavascriptAsyncTest("testDone")); |
| 642 } | 644 } |
| 643 | 645 |
| 644 // Test that calling testDone during RunJavascriptTest still completes when | 646 // Test that calling testDone during RunJavascriptTest still completes when |
| 645 // waiting for async result. | 647 // waiting for async result. |
| 646 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPasses) { | 648 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPasses) { |
| 647 ASSERT_TRUE(RunJavascriptTest("testDone")); | 649 ASSERT_TRUE(RunJavascriptTest("testDone")); |
| 648 } | 650 } |
| OLD | NEW |