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

Unified Diff: chrome/test/base/web_ui_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/web_ui_browsertest.h ('k') | chrome/test/data/webui/async_gen.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/base/web_ui_browsertest.cc
===================================================================
--- chrome/test/base/web_ui_browsertest.cc (revision 179158)
+++ chrome/test/base/web_ui_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/web_ui_browsertest.h"
+#include "chrome/test/base/web_ui_browsertest.h"
#include <string>
#include <vector>
@@ -20,10 +20,10 @@
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
-#include "chrome/browser/ui/webui/test_chrome_web_ui_controller_factory.h"
#include "chrome/browser/ui/webui/web_ui_test_handler.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/url_constants.h"
+#include "chrome/test/base/test_chrome_web_ui_controller_factory.h"
#include "chrome/test/base/test_tab_strip_model_observer.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/navigation_controller.h"
@@ -320,20 +320,16 @@
} // namespace
void WebUIBrowserTest::SetUpOnMainThread() {
- InProcessBrowserTest::SetUpOnMainThread();
-
logging::SetLogMessageHandler(&LogHandler);
-}
-void WebUIBrowserTest::CleanUpOnMainThread() {
- InProcessBrowserTest::CleanUpOnMainThread();
+ content::WebUIControllerFactory::UnregisterFactoryForTesting(
+ ChromeWebUIControllerFactory::GetInstance());
- logging::SetLogMessageHandler(NULL);
-}
+ test_factory_.reset(new TestChromeWebUIControllerFactory);
-void WebUIBrowserTest::SetUpInProcessBrowserTestFixture() {
- InProcessBrowserTest::SetUpInProcessBrowserTestFixture();
- TestChromeWebUIControllerFactory::AddFactoryOverride(
+ content::WebUIControllerFactory::RegisterFactory(test_factory_.get());
+
+ test_factory_->AddFactoryOverride(
GURL(kDummyURL).host(), mock_provider_.Pointer());
ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory_));
@@ -352,10 +348,14 @@
AddLibrary(FilePath(kWebUILibraryJS));
}
-void WebUIBrowserTest::TearDownInProcessBrowserTestFixture() {
- InProcessBrowserTest::TearDownInProcessBrowserTestFixture();
- TestChromeWebUIControllerFactory::RemoveFactoryOverride(
- GURL(kDummyURL).host());
+void WebUIBrowserTest::CleanUpOnMainThread() {
+ logging::SetLogMessageHandler(NULL);
+
+ test_factory_->RemoveFactoryOverride(GURL(kDummyURL).host());
+ content::WebUIControllerFactory::UnregisterFactoryForTesting(
+ test_factory_.get());
+
+ test_factory_.reset();
}
void WebUIBrowserTest::SetWebUIInstance(content::WebUI* web_ui) {
« no previous file with comments | « chrome/test/base/web_ui_browsertest.h ('k') | chrome/test/data/webui/async_gen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698