| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_suite.h" | 5 #include "chrome/test/ui/ui_test_suite.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/env_var.h" | 9 #include "base/env_var.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "base/process_util.h" | 11 #include "base/process_util.h" |
| 12 #include "chrome/common/env_vars.h" | 12 #include "chrome/common/env_vars.h" |
| 13 | 13 |
| 14 // Force a test to use an already running browser instance. UI tests only. | |
| 15 const char UITestSuite::kUseExistingBrowser[] = "use-existing-browser"; | |
| 16 | |
| 17 // Timeout for the test in milliseconds. UI tests only. | 14 // Timeout for the test in milliseconds. UI tests only. |
| 18 const char UITestSuite::kTestTimeout[] = "test-timeout"; | 15 const char UITestSuite::kTestTimeout[] = "test-timeout"; |
| 19 | 16 |
| 20 // Parameters to run test in parallel. UI tests only. | 17 // Parameters to run test in parallel. UI tests only. |
| 21 const char UITestSuite::kBatchCount[] = "batch-count"; | 18 const char UITestSuite::kBatchCount[] = "batch-count"; |
| 22 const char UITestSuite::kBatchIndex[] = "batch-index"; | 19 const char UITestSuite::kBatchIndex[] = "batch-index"; |
| 23 const char UITestSuite::kGTestTotalShards[] = "GTEST_TOTAL_SHARDS="; | 20 const char UITestSuite::kGTestTotalShards[] = "GTEST_TOTAL_SHARDS="; |
| 24 const char UITestSuite::kGTestShardIndex[] = "GTEST_SHARD_INDEX="; | 21 const char UITestSuite::kGTestShardIndex[] = "GTEST_SHARD_INDEX="; |
| 25 | 22 |
| 26 | 23 |
| 27 UITestSuite::UITestSuite(int argc, char** argv) | 24 UITestSuite::UITestSuite(int argc, char** argv) |
| 28 : ChromeTestSuite(argc, argv) { | 25 : ChromeTestSuite(argc, argv) { |
| 29 #if defined(OS_WIN) | 26 #if defined(OS_WIN) |
| 30 crash_service_ = NULL; | 27 crash_service_ = NULL; |
| 31 #endif | 28 #endif |
| 32 } | 29 } |
| 33 | 30 |
| 34 void UITestSuite::Initialize() { | 31 void UITestSuite::Initialize() { |
| 35 ChromeTestSuite::Initialize(); | 32 ChromeTestSuite::Initialize(); |
| 36 | 33 |
| 37 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); | 34 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
| 38 UITest::set_in_process_renderer( | 35 UITest::set_in_process_renderer( |
| 39 parsed_command_line.HasSwitch(switches::kSingleProcess)); | 36 parsed_command_line.HasSwitch(switches::kSingleProcess)); |
| 40 UITest::set_no_sandbox( | 37 UITest::set_no_sandbox( |
| 41 parsed_command_line.HasSwitch(switches::kNoSandbox)); | 38 parsed_command_line.HasSwitch(switches::kNoSandbox)); |
| 42 UITest::set_full_memory_dump( | 39 UITest::set_full_memory_dump( |
| 43 parsed_command_line.HasSwitch(switches::kFullMemoryCrashReport)); | 40 parsed_command_line.HasSwitch(switches::kFullMemoryCrashReport)); |
| 44 UITest::set_safe_plugins( | 41 UITest::set_safe_plugins( |
| 45 parsed_command_line.HasSwitch(switches::kSafePlugins)); | 42 parsed_command_line.HasSwitch(switches::kSafePlugins)); |
| 46 UITest::set_use_existing_browser( | |
| 47 parsed_command_line.HasSwitch(UITestSuite::kUseExistingBrowser)); | |
| 48 UITest::set_dump_histograms_on_exit( | 43 UITest::set_dump_histograms_on_exit( |
| 49 parsed_command_line.HasSwitch(switches::kDumpHistogramsOnExit)); | 44 parsed_command_line.HasSwitch(switches::kDumpHistogramsOnExit)); |
| 50 UITest::set_enable_dcheck( | 45 UITest::set_enable_dcheck( |
| 51 parsed_command_line.HasSwitch(switches::kEnableDCHECK)); | 46 parsed_command_line.HasSwitch(switches::kEnableDCHECK)); |
| 52 UITest::set_silent_dump_on_dcheck( | 47 UITest::set_silent_dump_on_dcheck( |
| 53 parsed_command_line.HasSwitch(switches::kSilentDumpOnDCHECK)); | 48 parsed_command_line.HasSwitch(switches::kSilentDumpOnDCHECK)); |
| 54 UITest::set_disable_breakpad( | 49 UITest::set_disable_breakpad( |
| 55 parsed_command_line.HasSwitch(switches::kDisableBreakpad)); | 50 parsed_command_line.HasSwitch(switches::kDisableBreakpad)); |
| 56 std::wstring test_timeout = | 51 std::wstring test_timeout = |
| 57 parsed_command_line.GetSwitchValue(UITestSuite::kTestTimeout); | 52 parsed_command_line.GetSwitchValue(UITestSuite::kTestTimeout); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 if (!base::LaunchApp(crash_service.ToWStringHack(), false, false, | 130 if (!base::LaunchApp(crash_service.ToWStringHack(), false, false, |
| 136 &crash_service_)) { | 131 &crash_service_)) { |
| 137 printf("Couldn't start crash_service.exe, so this ui_test run won't tell " \ | 132 printf("Couldn't start crash_service.exe, so this ui_test run won't tell " \ |
| 138 "you if any test crashes!\n"); | 133 "you if any test crashes!\n"); |
| 139 return; | 134 return; |
| 140 } | 135 } |
| 141 | 136 |
| 142 printf("Started crash_service.exe so you know if a test crashes!\n"); | 137 printf("Started crash_service.exe so you know if a test crashes!\n"); |
| 143 } | 138 } |
| 144 #endif | 139 #endif |
| OLD | NEW |