OLD | NEW |
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 "base/base_switches.h" | 10 #include "base/base_switches.h" |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 CleanupAppProcesses(); | 439 CleanupAppProcesses(); |
440 } | 440 } |
441 } | 441 } |
442 | 442 |
443 // Don't forget to close the handle | 443 // Don't forget to close the handle |
444 base::CloseProcessHandle(process_); | 444 base::CloseProcessHandle(process_); |
445 process_ = NULL; | 445 process_ = NULL; |
446 } | 446 } |
447 | 447 |
448 void UITest::AssertAppNotRunning(const std::wstring& error_message) { | 448 void UITest::AssertAppNotRunning(const std::wstring& error_message) { |
449 #if defined(OS_WIN) || defined(OS_LINUX) | |
450 ASSERT_EQ(0, GetBrowserProcessCount()) << error_message; | 449 ASSERT_EQ(0, GetBrowserProcessCount()) << error_message; |
451 #else | |
452 // TODO(port): Enable when chrome_process_util is ported. | |
453 NOTIMPLEMENTED(); | |
454 #endif | |
455 } | 450 } |
456 | 451 |
457 void UITest::CleanupAppProcesses() { | 452 void UITest::CleanupAppProcesses() { |
458 #if defined(OS_WIN) || defined(OS_LINUX) | |
459 TerminateAllChromeProcesses(user_data_dir()); | 453 TerminateAllChromeProcesses(user_data_dir()); |
460 | 454 |
461 // Suppress spammy failures that seem to be occurring when running | 455 // Suppress spammy failures that seem to be occurring when running |
462 // the UI tests in single-process mode. | 456 // the UI tests in single-process mode. |
463 // TODO(jhughes): figure out why this is necessary at all, and fix it | 457 // TODO(jhughes): figure out why this is necessary at all, and fix it |
464 if (!in_process_renderer_) | 458 if (!in_process_renderer_) |
465 AssertAppNotRunning(L"Unable to quit all browser processes."); | 459 AssertAppNotRunning(L"Unable to quit all browser processes."); |
466 #else | |
467 // TODO(port): depends on chrome_process_util. | |
468 NOTIMPLEMENTED(); | |
469 #endif | |
470 } | 460 } |
471 | 461 |
472 TabProxy* UITest::GetActiveTab(int window_index) { | 462 TabProxy* UITest::GetActiveTab(int window_index) { |
473 EXPECT_GE(window_index, 0); | 463 EXPECT_GE(window_index, 0); |
474 int window_count; | 464 int window_count; |
475 // Use EXPECT rather than ASSERT here because ASSERT_* returns void. | 465 // Use EXPECT rather than ASSERT here because ASSERT_* returns void. |
476 EXPECT_TRUE(automation()->GetBrowserWindowCount(&window_count)); | 466 EXPECT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
477 EXPECT_GT(window_count, window_index); | 467 EXPECT_GT(window_count, window_index); |
478 scoped_ptr<BrowserProxy> window_proxy(automation()-> | 468 scoped_ptr<BrowserProxy> window_proxy(automation()-> |
479 GetBrowserWindow(window_index)); | 469 GetBrowserWindow(window_index)); |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 } | 863 } |
874 | 864 |
875 bool UITest::EvictFileFromSystemCacheWrapper(const FilePath& path) { | 865 bool UITest::EvictFileFromSystemCacheWrapper(const FilePath& path) { |
876 for (int i = 0; i < 10; i++) { | 866 for (int i = 0; i < 10; i++) { |
877 if (file_util::EvictFileFromSystemCache(path)) | 867 if (file_util::EvictFileFromSystemCache(path)) |
878 return true; | 868 return true; |
879 PlatformThread::Sleep(1000); | 869 PlatformThread::Sleep(1000); |
880 } | 870 } |
881 return false; | 871 return false; |
882 } | 872 } |
OLD | NEW |