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

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

Issue 1377001: [GTTF] Various ui tests cleanups: (Closed)
Patch Set: Created 10 years, 9 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
« chrome/browser/images_uitest.cc ('K') | « chrome/test/ui/ui_test.h ('k') | no next file » | 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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "app/sql/connection.h" 10 #include "app/sql/connection.h"
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 CleanupAppProcesses(); 460 CleanupAppProcesses();
461 } 461 }
462 } 462 }
463 463
464 // Don't forget to close the handle 464 // Don't forget to close the handle
465 base::CloseProcessHandle(process_); 465 base::CloseProcessHandle(process_);
466 process_ = base::kNullProcessHandle; 466 process_ = base::kNullProcessHandle;
467 process_id_ = -1; 467 process_id_ = -1;
468 } 468 }
469 469
470 void UITestBase::TerminateBrowser() {
471 // There's nothing to do here if the browser is not running.
472 if (!IsBrowserRunning())
473 return;
474
475 EXPECT_TRUE(automation()->SetFilteredInet(false));
476 #if defined(OS_WIN)
477 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
478 ASSERT_TRUE(browser.get());
479 ASSERT_TRUE(browser->TerminateSession());
480 #endif // defined(OS_WIN)
481
482 // Now, drop the automation IPC channel so that the automation provider in
483 // the browser notices and drops its reference to the browser process.
484 automation()->Disconnect();
485
486 #if defined(OS_POSIX)
487 EXPECT_EQ(kill(process_, SIGTERM), 0);
488 #endif // OS_POSIX
489
490 // Wait for the browser process to quit.
491 int timeout = terminate_timeout_ms_;
492 #ifdef WAIT_FOR_DEBUGGER_ON_OPEN
493 timeout = 500000;
494 #endif
495 if (!base::WaitForSingleProcess(process_, timeout)) {
496 // We need to force the browser to quit because it didn't quit fast
497 // enough. Take no chance and kill every chrome processes.
498 CleanupAppProcesses();
499 }
500
501 // Don't forget to close the handle
502 base::CloseProcessHandle(process_);
503 process_ = base::kNullProcessHandle;
504 process_id_ = -1;
505 }
506
470 void UITestBase::AssertAppNotRunning(const std::wstring& error_message) { 507 void UITestBase::AssertAppNotRunning(const std::wstring& error_message) {
471 std::wstring final_error_message(error_message); 508 std::wstring final_error_message(error_message);
472 509
473 ChromeProcessList processes = GetRunningChromeProcesses(process_id_); 510 ChromeProcessList processes = GetRunningChromeProcesses(process_id_);
474 if (!processes.empty()) { 511 if (!processes.empty()) {
475 final_error_message += L" Leftover PIDs: ["; 512 final_error_message += L" Leftover PIDs: [";
476 for (ChromeProcessList::const_iterator it = processes.begin(); 513 for (ChromeProcessList::const_iterator it = processes.begin();
477 it != processes.end(); ++it) { 514 it != processes.end(); ++it) {
478 final_error_message += StringPrintf(L" %d", *it); 515 final_error_message += StringPrintf(L" %d", *it);
479 } 516 }
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after
1509 set_ui_test_name(ASCIIToWide(test_name)); 1546 set_ui_test_name(ASCIIToWide(test_name));
1510 } 1547 }
1511 UITestBase::SetUp(); 1548 UITestBase::SetUp();
1512 PlatformTest::SetUp(); 1549 PlatformTest::SetUp();
1513 } 1550 }
1514 1551
1515 void UITest::TearDown() { 1552 void UITest::TearDown() {
1516 UITestBase::TearDown(); 1553 UITestBase::TearDown();
1517 PlatformTest::TearDown(); 1554 PlatformTest::TearDown();
1518 } 1555 }
OLDNEW
« chrome/browser/images_uitest.cc ('K') | « chrome/test/ui/ui_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698