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

Unified Diff: chrome/test/base/test_chrome_web_ui_controller_factory_browsertest.cc

Issue 12084029: Simplify how TestChromeWebUIControllerFactory is registered now that multiple WebUIControllerFactor… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync to head Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/base/test_chrome_web_ui_controller_factory.cc ('k') | chrome/test/base/web_ui_browsertest.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/base/test_chrome_web_ui_controller_factory_browsertest.cc
===================================================================
--- chrome/test/base/test_chrome_web_ui_controller_factory_browsertest.cc (revision 179158)
+++ chrome/test/base/test_chrome_web_ui_controller_factory_browsertest.cc (working copy)
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/ui/webui/test_chrome_web_ui_controller_factory.h"
+#include "chrome/test/base/test_chrome_web_ui_controller_factory.h"
#include "content/public/browser/web_ui_controller.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
@@ -43,19 +43,27 @@
// going to this handler.
class TestChromeWebUIControllerFactoryTest : public InProcessBrowserTest {
public:
- virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
- InProcessBrowserTest::SetUpInProcessBrowserTestFixture();
- TestChromeWebUIControllerFactory::AddFactoryOverride(
+ virtual void SetUpOnMainThread() OVERRIDE {
+ content::WebUIControllerFactory::UnregisterFactoryForTesting(
+ ChromeWebUIControllerFactory::GetInstance());
+ test_factory_.reset(new TestChromeWebUIControllerFactory);
+ content::WebUIControllerFactory::RegisterFactory(test_factory_.get());
+ test_factory_->AddFactoryOverride(
GURL(kChromeTestChromeWebUIControllerFactory).host(), &mock_provider_);
}
- virtual void TearDownInProcessBrowserTestFixture() OVERRIDE {
- TestChromeWebUIControllerFactory::RemoveFactoryOverride(
+ virtual void CleanUpOnMainThread() OVERRIDE {
+ test_factory_->RemoveFactoryOverride(
GURL(kChromeTestChromeWebUIControllerFactory).host());
+ content::WebUIControllerFactory::UnregisterFactoryForTesting(
+ test_factory_.get());
+
+ test_factory_.reset();
}
protected:
StrictMock<MockWebUIProvider> mock_provider_;
+ scoped_ptr<TestChromeWebUIControllerFactory> test_factory_;
};
} // namespace
« no previous file with comments | « chrome/test/base/test_chrome_web_ui_controller_factory.cc ('k') | chrome/test/base/web_ui_browsertest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698