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

Side by Side Diff: chrome/test/ui/ui_test.cc

Issue 10202005: Convert the session restore ui_tests to browser_tests. I renabled the disabled tests; hopefully the… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: renable the mac test Created 8 years, 8 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
« no previous file with comments | « chrome/test/ui/ui_test.h ('k') | content/test/test_launcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/ui/ui_test.h" 5 #include "chrome/test/ui/ui_test.h"
6 6
7 #if defined(OS_POSIX) 7 #if defined(OS_POSIX)
8 #include <signal.h> 8 #include <signal.h>
9 #include <sys/types.h> 9 #include <sys/types.h>
10 #endif 10 #endif
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 launcher_->CloseBrowserAndServer(); 243 launcher_->CloseBrowserAndServer();
244 } 244 }
245 245
246 void UITestBase::LaunchBrowser(const CommandLine& arguments, 246 void UITestBase::LaunchBrowser(const CommandLine& arguments,
247 bool clear_profile) { 247 bool clear_profile) {
248 ProxyLauncher::LaunchState state = DefaultLaunchState(); 248 ProxyLauncher::LaunchState state = DefaultLaunchState();
249 state.clear_profile = clear_profile; 249 state.clear_profile = clear_profile;
250 ASSERT_TRUE(launcher_->LaunchBrowser(state)); 250 ASSERT_TRUE(launcher_->LaunchBrowser(state));
251 } 251 }
252 252
253 #if !defined(OS_MACOSX)
254 bool UITestBase::LaunchAnotherBrowserBlockUntilClosed(
255 const CommandLine& cmdline) {
256 ProxyLauncher::LaunchState state = DefaultLaunchState();
257 state.command.AppendArguments(cmdline, false);
258 return launcher_->LaunchAnotherBrowserBlockUntilClosed(state);
259 }
260
261 bool UITestBase::LaunchAnotherBrowserNoUrlArg(const CommandLine& cmdline) {
262 // Clear the homepage temporarily, and reset the launch switches, so that the
263 // URL argument doesn't get added.
264
265 std::string homepage_original;
266 std::swap(homepage_original, homepage_);
267
268 CommandLine launch_arguments_original(launch_arguments_);
269 launch_arguments_ = CommandLine(launch_arguments_.GetProgram());
270
271 SetLaunchSwitches();
272
273 ProxyLauncher::LaunchState state = DefaultLaunchState();
274
275 // But do add the --homepage switch
276 state.command.AppendSwitchASCII(switches::kHomePage, homepage_original);
277
278 state.command.AppendArguments(cmdline, false);
279 bool result = launcher_->LaunchAnotherBrowserBlockUntilClosed(state);
280
281 // Reset launch_arguments_ and homepage_ to their original values.
282 std::swap(homepage_original, homepage_);
283 std::swap(launch_arguments_original, launch_arguments_);
284
285 return result;
286 }
287 #endif
288
289 void UITestBase::QuitBrowser() { 253 void UITestBase::QuitBrowser() {
290 launcher_->QuitBrowser(); 254 launcher_->QuitBrowser();
291 } 255 }
292 256
293 scoped_refptr<TabProxy> UITestBase::GetActiveTab(int window_index) { 257 scoped_refptr<TabProxy> UITestBase::GetActiveTab(int window_index) {
294 EXPECT_GE(window_index, 0); 258 EXPECT_GE(window_index, 0);
295 int window_count = -1; 259 int window_count = -1;
296 // We have to use EXPECT rather than ASSERT here because ASSERT_* only works 260 // We have to use EXPECT rather than ASSERT here because ASSERT_* only works
297 // in functions that return void. 261 // in functions that return void.
298 EXPECT_TRUE(automation()->GetBrowserWindowCount(&window_count)); 262 EXPECT_TRUE(automation()->GetBrowserWindowCount(&window_count));
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 base::PlatformThread::Sleep(kDelay); 752 base::PlatformThread::Sleep(kDelay);
789 } 753 }
790 754
791 LOG(INFO) << "Elapsed time: " << (base::Time::Now() - start).InSecondsF() 755 LOG(INFO) << "Elapsed time: " << (base::Time::Now() - start).InSecondsF()
792 << " seconds" 756 << " seconds"
793 << " call failed " << fail_count << " times" 757 << " call failed " << fail_count << " times"
794 << " state was incorrect " << incorrect_state_count << " times"; 758 << " state was incorrect " << incorrect_state_count << " times";
795 ADD_FAILURE() << "Timeout reached in " << __FUNCTION__; 759 ADD_FAILURE() << "Timeout reached in " << __FUNCTION__;
796 return false; 760 return false;
797 } 761 }
OLDNEW
« no previous file with comments | « chrome/test/ui/ui_test.h ('k') | content/test/test_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698