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

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

Issue 7980026: Move some chrome-specific bits out of InProcessBrowserTest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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/in_process_browser_test.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/base/in_process_browser_test.cc
diff --git a/chrome/test/base/in_process_browser_test.cc b/chrome/test/base/in_process_browser_test.cc
index 7986608b1224b1f2f8b67e485d17db3933dea469..43b105c28c82ab13c6e88a93427543862d70b886 100644
--- a/chrome/test/base/in_process_browser_test.cc
+++ b/chrome/test/base/in_process_browser_test.cc
@@ -13,10 +13,7 @@
#include "base/string_number_conversions.h"
#include "base/test/test_file_util.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/browser_shutdown.h"
-#include "chrome/browser/intranet_redirect_detector.h"
#include "chrome/browser/io_thread.h"
-#include "chrome/browser/net/url_request_mock_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/tabs/tab_strip_model.h"
@@ -47,18 +44,12 @@
#include "base/system_monitor/system_monitor.h"
#endif
-#if defined(OS_WIN)
-#include "chrome/browser/ui/views/frame/browser_frame_win.h"
-#endif
-
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/audio_handler.h"
#endif
extern int BrowserMain(const MainFunctionParams&);
-const char kUnitTestShowWindows[] = "show-windows";
-
// Passed as value of kTestType.
static const char kBrowserTestType[] = "browser";
@@ -106,11 +97,6 @@ void InProcessBrowserTest::SetUp() {
ASSERT_TRUE(SetUpUserDataDirectory())
<< "Could not set up user data directory.";
- // Don't delete the resources when BrowserMain returns. Many ui classes
- // cache SkBitmaps in a static field so that if we delete the resource
- // bundle we'll crash.
- browser_shutdown::delete_resources_on_shutdown = false;
-
CommandLine* command_line = CommandLine::ForCurrentProcess();
// Allow subclasses to change the command line before running any tests.
SetUpCommandLine(command_line);
@@ -133,13 +119,7 @@ void InProcessBrowserTest::SetUp() {
file_util::CreateDirectory(log_dir);
#endif // defined(OS_CHROMEOS)
- SandboxInitWrapper sandbox_wrapper;
- MainFunctionParams params(*command_line, sandbox_wrapper, NULL);
- params.ui_task =
- NewRunnableMethod(this, &InProcessBrowserTest::RunTestOnMainThreadLoop);
-
- host_resolver_ = new net::RuleBasedHostResolverProc(
- new IntranetRedirectHostResolverProc(NULL));
+ host_resolver_ = new net::RuleBasedHostResolverProc(NULL);
// Something inside the browser does this lookup implicitly. Make it fail
// to avoid external dependency. It won't break the tests.
@@ -152,8 +132,12 @@ void InProcessBrowserTest::SetUp() {
net::ScopedDefaultHostResolverProc scoped_host_resolver_proc(
host_resolver_.get());
- SetUpInProcessBrowserTestFixture();
+ SandboxInitWrapper sandbox_wrapper;
+ MainFunctionParams params(*command_line, sandbox_wrapper, NULL);
+ params.ui_task =
+ NewRunnableMethod(this, &InProcessBrowserTest::RunTestOnMainThreadLoop);
+ SetUpInProcessBrowserTestFixture();
BrowserMain(params);
TearDownInProcessBrowserTestFixture();
}
@@ -162,12 +146,6 @@ void InProcessBrowserTest::PrepareTestCommandLine(CommandLine* command_line) {
// Propagate commandline settings from test_launcher_utils.
test_launcher_utils::PrepareBrowserCommandLineForTests(command_line);
-#if defined(OS_WIN)
- // Hide windows on show.
- if (!command_line->HasSwitch(kUnitTestShowWindows) && !show_window_)
sky 2011/09/21 00:12:34 Where are you going to move this code to?
Paweł Hajdan Jr. 2011/09/21 01:01:09 I think this is not needed. Don't windows show by
sky 2011/09/21 03:30:23 I believe they show by default, and this code is t
Paweł Hajdan Jr. 2011/09/21 16:36:37 I have just verified this on Windows. The windows
- BrowserFrameWin::SetShowState(SW_HIDE);
-#endif
-
if (dom_automation_enabled_)
command_line->AppendSwitch(switches::kDomAutomationController);
@@ -221,12 +199,6 @@ bool InProcessBrowserTest::CreateUserDataDirectory() {
void InProcessBrowserTest::TearDown() {
DCHECK(!g_browser_process);
-
- browser_shutdown::delete_resources_on_shutdown = true;
-
-#if defined(OS_WIN)
- BrowserFrameWin::SetShowState(-1);
-#endif
}
void InProcessBrowserTest::AddTabAtIndexToBrowser(
@@ -310,24 +282,9 @@ void InProcessBrowserTest::RunTestOnMainThreadLoop() {
// Pump startup related events.
MessageLoopForUI::current()->RunAllPending();
-
- // In the long term it would be great if we could use a TestingProfile
- // here and only enable services you want tested, but that requires all
- // consumers of Profile to handle NULL services.
- Profile* profile = ProfileManager::GetDefaultProfile();
- if (!profile) {
- // We should only be able to get here if the profile already exists and
- // has been created.
- NOTREACHED();
- return;
- }
pool.Recycle();
- BrowserThread::PostTask(
- BrowserThread::IO, FROM_HERE,
- NewRunnableFunction(chrome_browser_net::SetUrlRequestMocksEnabled, true));
-
- browser_ = CreateBrowser(profile);
+ browser_ = CreateBrowser(ProfileManager::GetDefaultProfile());
pool.Recycle();
// Pump any pending events that were created as a result of creating a
« no previous file with comments | « chrome/test/base/in_process_browser_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698