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

Side by Side Diff: chrome/test/base/test_chrome_web_ui_controller_factory_browsertest.cc

Issue 1100223002: Update {virtual,override} to follow C++11 style in chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 8 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
« no previous file with comments | « chrome/test/base/test_browser_window.h ('k') | chrome/test/base/ui_test_utils.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/test/base/in_process_browser_test.h" 5 #include "chrome/test/base/in_process_browser_test.h"
6 #include "chrome/test/base/test_chrome_web_ui_controller_factory.h" 6 #include "chrome/test/base/test_chrome_web_ui_controller_factory.h"
7 #include "chrome/test/base/ui_test_utils.h" 7 #include "chrome/test/base/ui_test_utils.h"
8 #include "content/public/browser/web_ui_controller.h" 8 #include "content/public/browser/web_ui_controller.h"
9 #include "testing/gmock/include/gmock/gmock.h" 9 #include "testing/gmock/include/gmock/gmock.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 25 matching lines...) Expand all
36 // Dummy URL location for us to override. 36 // Dummy URL location for us to override.
37 const char kChromeTestChromeWebUIControllerFactory[] = 37 const char kChromeTestChromeWebUIControllerFactory[] =
38 "chrome://ChromeTestChromeWebUIControllerFactory/"; 38 "chrome://ChromeTestChromeWebUIControllerFactory/";
39 39
40 // Sets up and tears down the factory override for our url's host. It is 40 // Sets up and tears down the factory override for our url's host. It is
41 // necessary to do this here, rather than in the test declaration, which is too 41 // necessary to do this here, rather than in the test declaration, which is too
42 // late to catch the possibility of an initial browse to about:blank mistakenly 42 // late to catch the possibility of an initial browse to about:blank mistakenly
43 // going to this handler. 43 // going to this handler.
44 class TestChromeWebUIControllerFactoryTest : public InProcessBrowserTest { 44 class TestChromeWebUIControllerFactoryTest : public InProcessBrowserTest {
45 public: 45 public:
46 virtual void SetUpOnMainThread() override { 46 void SetUpOnMainThread() override {
47 content::WebUIControllerFactory::UnregisterFactoryForTesting( 47 content::WebUIControllerFactory::UnregisterFactoryForTesting(
48 ChromeWebUIControllerFactory::GetInstance()); 48 ChromeWebUIControllerFactory::GetInstance());
49 test_factory_.reset(new TestChromeWebUIControllerFactory); 49 test_factory_.reset(new TestChromeWebUIControllerFactory);
50 content::WebUIControllerFactory::RegisterFactory(test_factory_.get()); 50 content::WebUIControllerFactory::RegisterFactory(test_factory_.get());
51 test_factory_->AddFactoryOverride( 51 test_factory_->AddFactoryOverride(
52 GURL(kChromeTestChromeWebUIControllerFactory).host(), &mock_provider_); 52 GURL(kChromeTestChromeWebUIControllerFactory).host(), &mock_provider_);
53 } 53 }
54 54
55 virtual void TearDownOnMainThread() override { 55 void TearDownOnMainThread() override {
56 test_factory_->RemoveFactoryOverride( 56 test_factory_->RemoveFactoryOverride(
57 GURL(kChromeTestChromeWebUIControllerFactory).host()); 57 GURL(kChromeTestChromeWebUIControllerFactory).host());
58 content::WebUIControllerFactory::UnregisterFactoryForTesting( 58 content::WebUIControllerFactory::UnregisterFactoryForTesting(
59 test_factory_.get()); 59 test_factory_.get());
60 60
61 test_factory_.reset(); 61 test_factory_.reset();
62 } 62 }
63 63
64 protected: 64 protected:
65 StrictMock<MockWebUIProvider> mock_provider_; 65 StrictMock<MockWebUIProvider> mock_provider_;
66 scoped_ptr<TestChromeWebUIControllerFactory> test_factory_; 66 scoped_ptr<TestChromeWebUIControllerFactory> test_factory_;
67 }; 67 };
68 68
69 } // namespace 69 } // namespace
70 70
71 // Test that browsing to our test url causes us to be called once. 71 // Test that browsing to our test url causes us to be called once.
72 IN_PROC_BROWSER_TEST_F(TestChromeWebUIControllerFactoryTest, 72 IN_PROC_BROWSER_TEST_F(TestChromeWebUIControllerFactoryTest,
73 TestWebUIProvider) { 73 TestWebUIProvider) {
74 const GURL kChromeTestChromeWebUIControllerFactoryURL( 74 const GURL kChromeTestChromeWebUIControllerFactoryURL(
75 kChromeTestChromeWebUIControllerFactory); 75 kChromeTestChromeWebUIControllerFactory);
76 EXPECT_CALL(mock_provider_, 76 EXPECT_CALL(mock_provider_,
77 NewWebUI(_, Eq(kChromeTestChromeWebUIControllerFactoryURL))) 77 NewWebUI(_, Eq(kChromeTestChromeWebUIControllerFactoryURL)))
78 .WillOnce(ReturnNewWebUI()); 78 .WillOnce(ReturnNewWebUI());
79 ui_test_utils::NavigateToURL(browser(), 79 ui_test_utils::NavigateToURL(browser(),
80 kChromeTestChromeWebUIControllerFactoryURL); 80 kChromeTestChromeWebUIControllerFactoryURL);
81 } 81 }
OLDNEW
« no previous file with comments | « chrome/test/base/test_browser_window.h ('k') | chrome/test/base/ui_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698