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

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

Issue 9188056: Start splitting out WebUI into an implementation class and an interface that each page implements... (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/task_manager_ui.cc ('k') | chrome/browser/ui/webui/tracing_ui.h » ('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 4
5 #include "chrome/browser/ui/webui/chrome_web_ui.h" 5 #include "chrome/browser/ui/webui/chrome_web_ui.h"
6 #include "chrome/browser/ui/webui/test_chrome_web_ui_factory.h" 6 #include "chrome/browser/ui/webui/test_chrome_web_ui_factory.h"
7 #include "content/public/browser/web_ui_controller.h"
7 #include "chrome/test/base/in_process_browser_test.h" 8 #include "chrome/test/base/in_process_browser_test.h"
8 #include "chrome/test/base/ui_test_utils.h" 9 #include "chrome/test/base/ui_test_utils.h"
9 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
10 #include "testing/gmock/include/gmock/gmock.h" 11 #include "testing/gmock/include/gmock/gmock.h"
11 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
12 13
13 using content::WebContents; 14 using content::WebContents;
14 using ::testing::_; 15 using ::testing::_;
15 using ::testing::Eq; 16 using ::testing::Eq;
16 using ::testing::StrictMock; 17 using ::testing::StrictMock;
17 18
18 namespace { 19 namespace {
19 20
20 // Returns a new WebUI object for the TabContents from |arg0|. 21 // Returns a new WebUI object for the TabContents from |arg0|.
21 ACTION(ReturnNewWebUI) { 22 ACTION(ReturnNewWebUI) {
22 return new WebUI(arg0); 23 static content::WebUIController temp_controller;
24 return new WebUI(arg0, &temp_controller);
23 } 25 }
24 26
25 // Mock the TestChromeWebUIFactory::WebUIProvider to prove that we are called as 27 // Mock the TestChromeWebUIFactory::WebUIProvider to prove that we are called as
26 // expected. 28 // expected.
27 class MockWebUIProvider : public TestChromeWebUIFactory::WebUIProvider { 29 class MockWebUIProvider : public TestChromeWebUIFactory::WebUIProvider {
28 public: 30 public:
29 MOCK_METHOD2(NewWebUI, WebUI*(WebContents* tab_contents, const GURL& url)); 31 MOCK_METHOD2(NewWebUI, WebUI*(WebContents* tab_contents, const GURL& url));
30 }; 32 };
31 33
32 // Dummy URL location for us to override. 34 // Dummy URL location for us to override.
(...skipping 23 matching lines...) Expand all
56 58
57 } // namespace 59 } // namespace
58 60
59 // Test that browsing to our test url causes us to be called once. 61 // Test that browsing to our test url causes us to be called once.
60 IN_PROC_BROWSER_TEST_F(TestChromeWebUIFactoryTest, TestWebUIProvider) { 62 IN_PROC_BROWSER_TEST_F(TestChromeWebUIFactoryTest, TestWebUIProvider) {
61 const GURL kChromeTestChromeWebUIFactoryURL(kChromeTestChromeWebUIFactory); 63 const GURL kChromeTestChromeWebUIFactoryURL(kChromeTestChromeWebUIFactory);
62 EXPECT_CALL(mock_provider_, NewWebUI(_, Eq(kChromeTestChromeWebUIFactoryURL))) 64 EXPECT_CALL(mock_provider_, NewWebUI(_, Eq(kChromeTestChromeWebUIFactoryURL)))
63 .WillOnce(ReturnNewWebUI()); 65 .WillOnce(ReturnNewWebUI());
64 ui_test_utils::NavigateToURL(browser(), kChromeTestChromeWebUIFactoryURL); 66 ui_test_utils::NavigateToURL(browser(), kChromeTestChromeWebUIFactoryURL);
65 } 67 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/task_manager_ui.cc ('k') | chrome/browser/ui/webui/tracing_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698