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

Side by Side Diff: webkit/tools/test_shell/test_shell_main.cc

Issue 18248: CommandLine API rework (Closed)
Patch Set: fixes Created 11 years, 11 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
« no previous file with comments | « webkit/tools/test_shell/test_shell.cc ('k') | webkit/tools/test_shell/test_shell_win.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) 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 // Creates an instance of the test_shell. 5 // Creates an instance of the test_shell.
6 #include "build/build_config.h" 6 #include "build/build_config.h"
7 7
8 #include <stdlib.h> // required by _set_abort_behavior 8 #include <stdlib.h> // required by _set_abort_behavior
9 9
10 #if defined(OS_WIN) 10 #if defined(OS_WIN)
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 #ifdef _CRTDBG_MAP_ALLOC 127 #ifdef _CRTDBG_MAP_ALLOC
128 _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); 128 _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
129 _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); 129 _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
130 #endif 130 #endif
131 // Some tests may use base::Singleton<>, thus we need to instanciate 131 // Some tests may use base::Singleton<>, thus we need to instanciate
132 // the AtExitManager or else we will leak objects. 132 // the AtExitManager or else we will leak objects.
133 base::AtExitManager at_exit_manager; 133 base::AtExitManager at_exit_manager;
134 134
135 #if defined(OS_LINUX) 135 #if defined(OS_LINUX)
136 gtk_init(&argc, &argv); 136 gtk_init(&argc, &argv);
137 // Only parse the command line after GTK's had a crack at it.
138 CommandLine::SetArgcArgv(argc, argv);
139 #endif 137 #endif
140 138
141 CommandLine parsed_command_line; 139 // Only parse the command line after GTK's had a crack at it.
140 CommandLine::Init(argc, argv);
141
142 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
142 if (parsed_command_line.HasSwitch(test_shell::kStartupDialog)) 143 if (parsed_command_line.HasSwitch(test_shell::kStartupDialog))
143 TestShell::ShowStartupDebuggingDialog(); 144 TestShell::ShowStartupDebuggingDialog();
144 145
145 if (parsed_command_line.HasSwitch(test_shell::kCheckLayoutTestSystemDeps)) { 146 if (parsed_command_line.HasSwitch(test_shell::kCheckLayoutTestSystemDeps)) {
146 exit(CheckLayoutTestSystemDependencies() ? 0 : 1); 147 exit(CheckLayoutTestSystemDependencies() ? 0 : 1);
147 } 148 }
148 149
149 // Allocate a message loop for this thread. Although it is not used 150 // Allocate a message loop for this thread. Although it is not used
150 // directly, its constructor sets up some necessary state. 151 // directly, its constructor sets up some necessary state.
151 MessageLoopForUI main_message_loop; 152 MessageLoopForUI main_message_loop;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 259
259 // Default to a homepage if we're interactive. 260 // Default to a homepage if we're interactive.
260 if (!layout_test_mode) { 261 if (!layout_test_mode) {
261 PathService::Get(base::DIR_SOURCE_ROOT, &uri); 262 PathService::Get(base::DIR_SOURCE_ROOT, &uri);
262 file_util::AppendToPath(&uri, L"webkit"); 263 file_util::AppendToPath(&uri, L"webkit");
263 file_util::AppendToPath(&uri, L"data"); 264 file_util::AppendToPath(&uri, L"data");
264 file_util::AppendToPath(&uri, L"test_shell"); 265 file_util::AppendToPath(&uri, L"test_shell");
265 file_util::AppendToPath(&uri, L"index.html"); 266 file_util::AppendToPath(&uri, L"index.html");
266 } 267 }
267 268
268 if (parsed_command_line.GetLooseValueCount() > 0) { 269 std::vector<std::wstring> loose_values = parsed_command_line.GetLooseValues();
269 CommandLine::LooseValueIterator iter( 270 if (loose_values.size() > 0)
270 parsed_command_line.GetLooseValuesBegin()); 271 uri = loose_values[0];
271 uri = *iter;
272 }
273 272
274 std::wstring js_flags = 273 std::wstring js_flags =
275 parsed_command_line.GetSwitchValue(test_shell::kJavaScriptFlags); 274 parsed_command_line.GetSwitchValue(test_shell::kJavaScriptFlags);
276 // Test shell always exposes the GC. 275 // Test shell always exposes the GC.
277 CommandLine::AppendSwitch(&js_flags, L"expose-gc"); 276 js_flags += L" --expose-gc";
278 webkit_glue::SetJavaScriptFlags(js_flags); 277 webkit_glue::SetJavaScriptFlags(js_flags);
279 // Also expose GCController to JavaScript. 278 // Also expose GCController to JavaScript.
280 webkit_glue::SetShouldExposeGCController(true); 279 webkit_glue::SetShouldExposeGCController(true);
281 280
282 // Load and initialize the stats table. Attempt to construct a somewhat 281 // Load and initialize the stats table. Attempt to construct a somewhat
283 // unique name to isolate separate instances from each other. 282 // unique name to isolate separate instances from each other.
284 StatsTable *table = new StatsTable( 283 StatsTable *table = new StatsTable(
285 kStatsFilePrefix + Uint64ToString(base::RandUint64()), 284 kStatsFilePrefix + Uint64ToString(base::RandUint64()),
286 kStatsFileThreads, 285 kStatsFileThreads,
287 kStatsFileCounters); 286 kStatsFileCounters);
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 394
396 // Tear down shared StatsTable; prevents unit_tests from leaking it. 395 // Tear down shared StatsTable; prevents unit_tests from leaking it.
397 StatsTable::set_current(NULL); 396 StatsTable::set_current(NULL);
398 delete table; 397 delete table;
399 398
400 #ifdef _CRTDBG_MAP_ALLOC 399 #ifdef _CRTDBG_MAP_ALLOC
401 _CrtDumpMemoryLeaks(); 400 _CrtDumpMemoryLeaks();
402 #endif 401 #endif
403 return 0; 402 return 0;
404 } 403 }
OLDNEW
« no previous file with comments | « webkit/tools/test_shell/test_shell.cc ('k') | webkit/tools/test_shell/test_shell_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698