| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 const wchar_t kExtraChromeFlagsSwitch[] = L"extra-chrome-flags"; | 75 const wchar_t kExtraChromeFlagsSwitch[] = L"extra-chrome-flags"; |
| 76 | 76 |
| 77 // By default error dialogs are hidden, which makes debugging failures in the | 77 // By default error dialogs are hidden, which makes debugging failures in the |
| 78 // slave process frustrating. By passing this in error dialogs are enabled. | 78 // slave process frustrating. By passing this in error dialogs are enabled. |
| 79 const wchar_t kEnableErrorDialogs[] = L"enable-errdialogs"; | 79 const wchar_t kEnableErrorDialogs[] = L"enable-errdialogs"; |
| 80 | 80 |
| 81 // Uncomment this line to have the spawned process wait for the debugger to | 81 // Uncomment this line to have the spawned process wait for the debugger to |
| 82 // attach. | 82 // attach. |
| 83 // #define WAIT_FOR_DEBUGGER_ON_OPEN 1 | 83 // #define WAIT_FOR_DEBUGGER_ON_OPEN 1 |
| 84 | 84 |
| 85 // static | 85 bool UITest::DieFileDie(const FilePath& file, bool recurse) { |
| 86 bool UITest::DieFileDie(const std::wstring& file, bool recurse) { | |
| 87 if (!file_util::PathExists(file)) | 86 if (!file_util::PathExists(file)) |
| 88 return true; | 87 return true; |
| 89 | 88 |
| 90 // Sometimes Delete fails, so try a few more times. | 89 // Sometimes Delete fails, so try a few more times. |
| 91 for (int i = 0; i < 10; ++i) { | 90 for (int i = 0; i < 10; ++i) { |
| 92 if (file_util::Delete(file, recurse)) | 91 if (file_util::Delete(file, recurse)) |
| 93 return true; | 92 return true; |
| 94 PlatformThread::Sleep(action_max_timeout_ms() / 10); | 93 PlatformThread::Sleep(action_max_timeout_ms() / 10); |
| 95 } | 94 } |
| 96 return false; | 95 return false; |
| 97 } | 96 } |
| 97 bool UITest::DieFileDie(const std::wstring& file, bool recurse) { |
| 98 return DieFileDie(FilePath::FromWStringHack(file), recurse); |
| 99 } |
| 98 | 100 |
| 99 UITest::UITest() | 101 UITest::UITest() |
| 100 : testing::Test(), | 102 : testing::Test(), |
| 101 launch_arguments_(L""), | 103 launch_arguments_(L""), |
| 102 expected_errors_(0), | 104 expected_errors_(0), |
| 103 expected_crashes_(0), | 105 expected_crashes_(0), |
| 104 homepage_(L"about:blank"), | 106 homepage_(L"about:blank"), |
| 105 wait_for_initial_loads_(true), | 107 wait_for_initial_loads_(true), |
| 106 dom_automation_enabled_(false), | 108 dom_automation_enabled_(false), |
| 107 process_(0), // NULL on Windows, 0 PID on POSIX. | 109 process_(0), // NULL on Windows, 0 PID on POSIX. |
| (...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 } | 865 } |
| 864 | 866 |
| 865 bool UITest::EvictFileFromSystemCacheWrapper(const FilePath& path) { | 867 bool UITest::EvictFileFromSystemCacheWrapper(const FilePath& path) { |
| 866 for (int i = 0; i < 10; i++) { | 868 for (int i = 0; i < 10; i++) { |
| 867 if (file_util::EvictFileFromSystemCache(path)) | 869 if (file_util::EvictFileFromSystemCache(path)) |
| 868 return true; | 870 return true; |
| 869 PlatformThread::Sleep(1000); | 871 PlatformThread::Sleep(1000); |
| 870 } | 872 } |
| 871 return false; | 873 return false; |
| 872 } | 874 } |
| OLD | NEW |