Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(986)

Side by Side Diff: chrome/browser/ui/webui/web_ui_browsertest.cc

Issue 9003014: Replace WebUI::tab_contents() with web_contents() and switch all users to use web_contents.h inst... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/webui/uber/uber_ui.cc ('k') | chrome/browser/ui/webui/web_ui_test_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "testing/gmock/include/gmock/gmock.h" 26 #include "testing/gmock/include/gmock/gmock.h"
27 #include "testing/gtest/include/gtest/gtest-spi.h" 27 #include "testing/gtest/include/gtest/gtest-spi.h"
28 #include "ui/base/resource/resource_bundle.h" 28 #include "ui/base/resource/resource_bundle.h"
29 29
30 using content::WebContents;
31
30 namespace { 32 namespace {
31 33
32 const FilePath::CharType kMockJS[] = FILE_PATH_LITERAL("mock4js.js"); 34 const FilePath::CharType kMockJS[] = FILE_PATH_LITERAL("mock4js.js");
33 const FilePath::CharType kWebUILibraryJS[] = FILE_PATH_LITERAL("test_api.js"); 35 const FilePath::CharType kWebUILibraryJS[] = FILE_PATH_LITERAL("test_api.js");
34 const FilePath::CharType kWebUITestFolder[] = FILE_PATH_LITERAL("webui"); 36 const FilePath::CharType kWebUITestFolder[] = FILE_PATH_LITERAL("webui");
35 base::LazyInstance<std::vector<std::string> > error_messages_ = 37 base::LazyInstance<std::vector<std::string> > error_messages_ =
36 LAZY_INSTANCE_INITIALIZER; 38 LAZY_INSTANCE_INITIALIZER;
37 39
38 // Intercepts all log messages. 40 // Intercepts all log messages.
39 bool LogHandler(int severity, 41 bool LogHandler(int severity,
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 preload_test_name_ = preload_test_name; 231 preload_test_name_ = preload_test_name;
230 } 232 }
231 233
232 namespace { 234 namespace {
233 235
234 class MockWebUIProvider : public TestChromeWebUIFactory::WebUIProvider { 236 class MockWebUIProvider : public TestChromeWebUIFactory::WebUIProvider {
235 public: 237 public:
236 MockWebUIProvider() {} 238 MockWebUIProvider() {}
237 239
238 // Returns a new ChromeWebUI 240 // Returns a new ChromeWebUI
239 WebUI* NewWebUI(TabContents* tab_contents, const GURL& url) OVERRIDE { 241 WebUI* NewWebUI(WebContents* web_contents, const GURL& url) OVERRIDE {
240 return new ChromeWebUI(tab_contents); 242 return new ChromeWebUI(web_contents);
241 } 243 }
242 }; 244 };
243 245
244 base::LazyInstance<MockWebUIProvider> mock_provider_ = 246 base::LazyInstance<MockWebUIProvider> mock_provider_ =
245 LAZY_INSTANCE_INITIALIZER; 247 LAZY_INSTANCE_INITIALIZER;
246 248
247 } // namespace 249 } // namespace
248 250
249 void WebUIBrowserTest::SetUpOnMainThread() { 251 void WebUIBrowserTest::SetUpOnMainThread() {
250 InProcessBrowserTest::SetUpOnMainThread(); 252 InProcessBrowserTest::SetUpOnMainThread();
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 // testDone directly and expect pass result. 639 // testDone directly and expect pass result.
638 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPassesAsync) { 640 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPassesAsync) {
639 ASSERT_TRUE(RunJavascriptAsyncTest("testDone")); 641 ASSERT_TRUE(RunJavascriptAsyncTest("testDone"));
640 } 642 }
641 643
642 // Test that calling testDone during RunJavascriptTest still completes when 644 // Test that calling testDone during RunJavascriptTest still completes when
643 // waiting for async result. 645 // waiting for async result.
644 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPasses) { 646 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPasses) {
645 ASSERT_TRUE(RunJavascriptTest("testDone")); 647 ASSERT_TRUE(RunJavascriptTest("testDone"));
646 } 648 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/uber/uber_ui.cc ('k') | chrome/browser/ui/webui/web_ui_test_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698