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 | 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 "content/public/browser/web_ui_controller.h" |
8 #include "chrome/test/base/in_process_browser_test.h" | 8 #include "chrome/test/base/in_process_browser_test.h" |
9 #include "chrome/test/base/ui_test_utils.h" | 9 #include "chrome/test/base/ui_test_utils.h" |
10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
11 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 using content::WebContents; | 14 using content::WebContents; |
| 15 using content::WebUI; |
15 using content::WebUIController; | 16 using content::WebUIController; |
16 using ::testing::_; | 17 using ::testing::_; |
17 using ::testing::Eq; | 18 using ::testing::Eq; |
18 using ::testing::StrictMock; | 19 using ::testing::StrictMock; |
19 | 20 |
20 namespace { | 21 namespace { |
21 | 22 |
22 // Returns a new WebUI object for the TabContents from |arg0|. | 23 // Returns a new WebUI object for the TabContents from |arg0|. |
23 ACTION(ReturnNewWebUI) { | 24 ACTION(ReturnNewWebUI) { |
24 return new WebUIController(arg0); | 25 return new WebUIController(arg0); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 60 |
60 } // namespace | 61 } // namespace |
61 | 62 |
62 // Test that browsing to our test url causes us to be called once. | 63 // Test that browsing to our test url causes us to be called once. |
63 IN_PROC_BROWSER_TEST_F(TestChromeWebUIFactoryTest, TestWebUIProvider) { | 64 IN_PROC_BROWSER_TEST_F(TestChromeWebUIFactoryTest, TestWebUIProvider) { |
64 const GURL kChromeTestChromeWebUIFactoryURL(kChromeTestChromeWebUIFactory); | 65 const GURL kChromeTestChromeWebUIFactoryURL(kChromeTestChromeWebUIFactory); |
65 EXPECT_CALL(mock_provider_, NewWebUI(_, Eq(kChromeTestChromeWebUIFactoryURL))) | 66 EXPECT_CALL(mock_provider_, NewWebUI(_, Eq(kChromeTestChromeWebUIFactoryURL))) |
66 .WillOnce(ReturnNewWebUI()); | 67 .WillOnce(ReturnNewWebUI()); |
67 ui_test_utils::NavigateToURL(browser(), kChromeTestChromeWebUIFactoryURL); | 68 ui_test_utils::NavigateToURL(browser(), kChromeTestChromeWebUIFactoryURL); |
68 } | 69 } |
OLD | NEW |