OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/web_ui_browser_test.h" | 5 #include "chrome/test/base/web_ui_browser_test.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 ChromeWebUIControllerFactory::GetInstance()); | 375 ChromeWebUIControllerFactory::GetInstance()); |
376 | 376 |
377 test_factory_.reset(new TestChromeWebUIControllerFactory); | 377 test_factory_.reset(new TestChromeWebUIControllerFactory); |
378 | 378 |
379 content::WebUIControllerFactory::RegisterFactory(test_factory_.get()); | 379 content::WebUIControllerFactory::RegisterFactory(test_factory_.get()); |
380 | 380 |
381 test_factory_->AddFactoryOverride(GURL(kDummyURL).host(), | 381 test_factory_->AddFactoryOverride(GURL(kDummyURL).host(), |
382 mock_provider_.Pointer()); | 382 mock_provider_.Pointer()); |
383 } | 383 } |
384 | 384 |
385 void WebUIBrowserTest::CleanUpOnMainThread() { | 385 void WebUIBrowserTest::TearDownOnMainThread() { |
386 logging::SetLogMessageHandler(NULL); | 386 logging::SetLogMessageHandler(NULL); |
387 | 387 |
388 test_factory_->RemoveFactoryOverride(GURL(kDummyURL).host()); | 388 test_factory_->RemoveFactoryOverride(GURL(kDummyURL).host()); |
389 content::WebUIControllerFactory::UnregisterFactoryForTesting( | 389 content::WebUIControllerFactory::UnregisterFactoryForTesting( |
390 test_factory_.get()); | 390 test_factory_.get()); |
391 | 391 |
392 // This is needed to avoid a debug assert after the test completes, see stack | 392 // This is needed to avoid a debug assert after the test completes, see stack |
393 // trace in http://crrev.com/179347 | 393 // trace in http://crrev.com/179347 |
394 content::WebUIControllerFactory::RegisterFactory( | 394 content::WebUIControllerFactory::RegisterFactory( |
395 ChromeWebUIControllerFactory::GetInstance()); | 395 ChromeWebUIControllerFactory::GetInstance()); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 } | 476 } |
477 | 477 |
478 GURL WebUIBrowserTest::WebUITestDataPathToURL( | 478 GURL WebUIBrowserTest::WebUITestDataPathToURL( |
479 const base::FilePath::StringType& path) { | 479 const base::FilePath::StringType& path) { |
480 base::FilePath dir_test_data; | 480 base::FilePath dir_test_data; |
481 EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &dir_test_data)); | 481 EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &dir_test_data)); |
482 base::FilePath test_path(dir_test_data.Append(kWebUITestFolder).Append(path)); | 482 base::FilePath test_path(dir_test_data.Append(kWebUITestFolder).Append(path)); |
483 EXPECT_TRUE(base::PathExists(test_path)); | 483 EXPECT_TRUE(base::PathExists(test_path)); |
484 return net::FilePathToFileURL(test_path); | 484 return net::FilePathToFileURL(test_path); |
485 } | 485 } |
OLD | NEW |