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

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

Issue 10820007: Move all the layout tests that ran under browser_tests to run under content_browsertests. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix mac Created 8 years, 5 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 | Annotate | Revision Log
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 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/stack_trace.h" 10 #include "base/debug/stack_trace.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // Before we run the browser, we have to hack the path to the exe to match 71 // Before we run the browser, we have to hack the path to the exe to match
72 // what it would be if Chrome was running, because it is used to fork renderer 72 // what it would be if Chrome was running, because it is used to fork renderer
73 // processes, on Linux at least (failure to do so will cause a browser_test to 73 // processes, on Linux at least (failure to do so will cause a browser_test to
74 // be run instead of a renderer). 74 // be run instead of a renderer).
75 FilePath chrome_path; 75 FilePath chrome_path;
76 CHECK(PathService::Get(base::FILE_EXE, &chrome_path)); 76 CHECK(PathService::Get(base::FILE_EXE, &chrome_path));
77 chrome_path = chrome_path.DirName(); 77 chrome_path = chrome_path.DirName();
78 chrome_path = chrome_path.Append(chrome::kBrowserProcessExecutablePath); 78 chrome_path = chrome_path.Append(chrome::kBrowserProcessExecutablePath);
79 CHECK(PathService::Override(base::FILE_EXE, chrome_path)); 79 CHECK(PathService::Override(base::FILE_EXE, chrome_path));
80 #endif // defined(OS_MACOSX) 80 #endif // defined(OS_MACOSX)
81 81 CreateTestServer("chrome/test/data");
82 test_server_.reset(new net::TestServer(
83 net::TestServer::TYPE_HTTP,
84 net::TestServer::kLocalhost,
85 FilePath(FILE_PATH_LITERAL("chrome/test/data"))));
86 } 82 }
87 83
88 InProcessBrowserTest::~InProcessBrowserTest() { 84 InProcessBrowserTest::~InProcessBrowserTest() {
89 } 85 }
90 86
91 void InProcessBrowserTest::SetUp() { 87 void InProcessBrowserTest::SetUp() {
92 // Undo TestingBrowserProcess creation in ChromeTestSuite. 88 // Undo TestingBrowserProcess creation in ChromeTestSuite.
93 // TODO(phajdan.jr): Extract a smaller test suite so we don't need this. 89 // TODO(phajdan.jr): Extract a smaller test suite so we don't need this.
94 DCHECK(g_browser_process); 90 DCHECK(g_browser_process);
95 delete g_browser_process; 91 delete g_browser_process;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 // time code is directly executed. 145 // time code is directly executed.
150 autorelease_pool_ = new base::mac::ScopedNSAutoreleasePool; 146 autorelease_pool_ = new base::mac::ScopedNSAutoreleasePool;
151 #endif 147 #endif
152 BrowserTestBase::SetUp(); 148 BrowserTestBase::SetUp();
153 } 149 }
154 150
155 void InProcessBrowserTest::PrepareTestCommandLine(CommandLine* command_line) { 151 void InProcessBrowserTest::PrepareTestCommandLine(CommandLine* command_line) {
156 // Propagate commandline settings from test_launcher_utils. 152 // Propagate commandline settings from test_launcher_utils.
157 test_launcher_utils::PrepareBrowserCommandLineForTests(command_line); 153 test_launcher_utils::PrepareBrowserCommandLineForTests(command_line);
158 154
159 command_line->AppendSwitch(switches::kDomAutomationController);
160
161 // This is a Browser test. 155 // This is a Browser test.
162 command_line->AppendSwitchASCII(switches::kTestType, kBrowserTestType); 156 command_line->AppendSwitchASCII(switches::kTestType, kBrowserTestType);
163 157
164 #if defined(OS_MACOSX) 158 #if defined(OS_MACOSX)
165 // Explicitly set the path of the binary used for child processes, otherwise 159 // Explicitly set the path of the binary used for child processes, otherwise
166 // they'll try to use browser_tests which doesn't contain ChromeMain. 160 // they'll try to use browser_tests which doesn't contain ChromeMain.
167 FilePath subprocess_path; 161 FilePath subprocess_path;
168 PathService::Get(base::FILE_EXE, &subprocess_path); 162 PathService::Get(base::FILE_EXE, &subprocess_path);
169 // Recreate the real environment, run the helper within the app bundle. 163 // Recreate the real environment, run the helper within the app bundle.
170 subprocess_path = subprocess_path.DirName().DirName(); 164 subprocess_path = subprocess_path.DirName().DirName();
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 // On the Mac, this eventually reaches 389 // On the Mac, this eventually reaches
396 // -[BrowserWindowController windowWillClose:], which will post a deferred 390 // -[BrowserWindowController windowWillClose:], which will post a deferred
397 // -autorelease on itself to ultimately destroy the Browser object. The line 391 // -autorelease on itself to ultimately destroy the Browser object. The line
398 // below is necessary to pump these pending messages to ensure all Browsers 392 // below is necessary to pump these pending messages to ensure all Browsers
399 // get deleted. 393 // get deleted.
400 ui_test_utils::RunAllPendingInMessageLoop(); 394 ui_test_utils::RunAllPendingInMessageLoop();
401 delete autorelease_pool_; 395 delete autorelease_pool_;
402 autorelease_pool_ = NULL; 396 autorelease_pool_ = NULL;
403 #endif 397 #endif
404 } 398 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698