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

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

Issue 7307034: Create ChromeWebUIFactory when testing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 5 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 | « no previous file | chrome/browser/ui/webui/web_ui_browsertest.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 4
5 #include "chrome/browser/ui/webui/chrome_web_ui.h"
5 #include "chrome/browser/ui/webui/test_chrome_web_ui_factory.h" 6 #include "chrome/browser/ui/webui/test_chrome_web_ui_factory.h"
6 #include "chrome/test/in_process_browser_test.h" 7 #include "chrome/test/in_process_browser_test.h"
7 #include "chrome/test/ui_test_utils.h" 8 #include "chrome/test/ui_test_utils.h"
8 #include "googleurl/src/gurl.h" 9 #include "googleurl/src/gurl.h"
9 #include "testing/gmock/include/gmock/gmock.h" 10 #include "testing/gmock/include/gmock/gmock.h"
10 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
11 12
12 using ::testing::_; 13 using ::testing::_;
13 using ::testing::Eq; 14 using ::testing::Eq;
14 using ::testing::StrictMock; 15 using ::testing::StrictMock;
15 16
16 namespace { 17 namespace {
17 18
18 // Returns a new WebUI object for the TabContents from |arg0|. 19 // Returns a new WebUI object for the TabContents from |arg0|.
19 ACTION(ReturnNewWebUI) { 20 ACTION(ReturnNewWebUI) {
20 return new WebUI(arg0); 21 return new ChromeWebUI(arg0);
21 } 22 }
22 23
23 // Mock the TestChromeWebUIFactory::WebUIProvider to prove that we are called as 24 // Mock the TestChromeWebUIFactory::WebUIProvider to prove that we are called as
24 // expected. 25 // expected.
25 class MockWebUIProvider : public TestChromeWebUIFactory::WebUIProvider { 26 class MockWebUIProvider : public TestChromeWebUIFactory::WebUIProvider {
26 public: 27 public:
27 MOCK_METHOD2(NewWebUI, WebUI*(TabContents* tab_contents, const GURL& url)); 28 MOCK_METHOD2(NewWebUI, WebUI*(TabContents* tab_contents, const GURL& url));
28 }; 29 };
29 30
30 // Dummy URL location for us to override. 31 // Dummy URL location for us to override.
(...skipping 23 matching lines...) Expand all
54 55
55 } // namespace 56 } // namespace
56 57
57 // Test that browsing to our test url causes us to be called once. 58 // Test that browsing to our test url causes us to be called once.
58 IN_PROC_BROWSER_TEST_F(TestChromeWebUIFactoryTest, TestWebUIProvider) { 59 IN_PROC_BROWSER_TEST_F(TestChromeWebUIFactoryTest, TestWebUIProvider) {
59 const GURL kChromeTestChromeWebUIFactoryURL(kChromeTestChromeWebUIFactory); 60 const GURL kChromeTestChromeWebUIFactoryURL(kChromeTestChromeWebUIFactory);
60 EXPECT_CALL(mock_provider_, NewWebUI(_, Eq(kChromeTestChromeWebUIFactoryURL))) 61 EXPECT_CALL(mock_provider_, NewWebUI(_, Eq(kChromeTestChromeWebUIFactoryURL)))
61 .WillOnce(ReturnNewWebUI()); 62 .WillOnce(ReturnNewWebUI());
62 ui_test_utils::NavigateToURL(browser(), kChromeTestChromeWebUIFactoryURL); 63 ui_test_utils::NavigateToURL(browser(), kChromeTestChromeWebUIFactoryURL);
63 } 64 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/web_ui_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698