OLD | NEW |
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 #include <sys/syslimits.h> | 6 #include <sys/syslimits.h> |
7 #include <unistd.h> | 7 #include <unistd.h> |
8 #import <mach/task.h> | 8 #import <mach/task.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 MessageLoop main_message_loop(MessageLoop::TYPE_UI); | 108 MessageLoop main_message_loop(MessageLoop::TYPE_UI); |
109 | 109 |
110 // Force AppKit to init itself, but don't start the runloop yet | 110 // Force AppKit to init itself, but don't start the runloop yet |
111 [NSApplication sharedApplication]; | 111 [NSApplication sharedApplication]; |
112 [NSBundle loadNibNamed:@"MainMenu" owner:NSApp]; | 112 [NSBundle loadNibNamed:@"MainMenu" owner:NSApp]; |
113 | 113 |
114 // Interpret the same flags as | 114 // Interpret the same flags as |
115 // the windows version, so that we can run the same test scripts. stop | 115 // the windows version, so that we can run the same test scripts. stop |
116 // if we hit something that's not a switch (like, oh, a URL). | 116 // if we hit something that's not a switch (like, oh, a URL). |
117 | 117 |
118 CommandLine::SetArgcArgv(argc, argv); | 118 CommandLine::Init(argc, argv); |
119 CommandLine parsed_command_line(argc, argv); | 119 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
120 | 120 |
121 if (parsed_command_line.HasSwitch(test_shell::kCheckLayoutTestSystemDeps)) { | 121 if (parsed_command_line.HasSwitch(test_shell::kCheckLayoutTestSystemDeps)) { |
122 // Always succeed the deps check, currently just used by windows port. | 122 // Always succeed the deps check, currently just used by windows port. |
123 exit(0); | 123 exit(0); |
124 } | 124 } |
125 | 125 |
126 if (parsed_command_line.HasSwitch(test_shell::kStartupDialog)) { | 126 if (parsed_command_line.HasSwitch(test_shell::kStartupDialog)) { |
127 //TODO: add alert to allow attaching via gdb before things really get going | 127 //TODO: add alert to allow attaching via gdb before things really get going |
128 } | 128 } |
129 | 129 |
(...skipping 30 matching lines...) Expand all Loading... |
160 const std::wstring timeout_str = parsed_command_line.GetSwitchValue( | 160 const std::wstring timeout_str = parsed_command_line.GetSwitchValue( |
161 test_shell::kTestShellTimeOut); | 161 test_shell::kTestShellTimeOut); |
162 int timeout_ms = static_cast<int>(StringToInt64(timeout_str.c_str())); | 162 int timeout_ms = static_cast<int>(StringToInt64(timeout_str.c_str())); |
163 if (timeout_ms > 0) | 163 if (timeout_ms > 0) |
164 TestShell::SetFileTestTimeout(timeout_ms); | 164 TestShell::SetFileTestTimeout(timeout_ms); |
165 } | 165 } |
166 | 166 |
167 std::wstring javascript_flags = | 167 std::wstring javascript_flags = |
168 parsed_command_line.GetSwitchValue(test_shell::kJavaScriptFlags); | 168 parsed_command_line.GetSwitchValue(test_shell::kJavaScriptFlags); |
169 // Test shell always exposes the GC. | 169 // Test shell always exposes the GC. |
170 CommandLine::AppendSwitch(&javascript_flags, L"expose-gc"); | 170 javascript_flags += L" --expose-gc"; |
171 webkit_glue::SetJavaScriptFlags(javascript_flags); | 171 webkit_glue::SetJavaScriptFlags(javascript_flags); |
172 | 172 |
173 // Load and initialize the stats table (one per process, so that multiple | 173 // Load and initialize the stats table (one per process, so that multiple |
174 // instances don't interfere with each other) | 174 // instances don't interfere with each other) |
175 char statsfile[64]; | 175 char statsfile[64]; |
176 snprintf(statsfile, 64, "%s-%d", kStatsFile, getpid()); | 176 snprintf(statsfile, 64, "%s-%d", kStatsFile, getpid()); |
177 StatsTable *table = | 177 StatsTable *table = |
178 new StatsTable(statsfile, kStatsFileThreads, kStatsFileCounters); | 178 new StatsTable(statsfile, kStatsFileThreads, kStatsFileCounters); |
179 StatsTable::set_current(table); | 179 StatsTable::set_current(table); |
180 | 180 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 NSString *resourcePath = [[NSBundle mainBundle] resourcePath]; | 228 NSString *resourcePath = [[NSBundle mainBundle] resourcePath]; |
229 NSString *testShellPath = | 229 NSString *testShellPath = |
230 [resourcePath stringByAppendingPathComponent:@"test_shell/index.html"]; | 230 [resourcePath stringByAppendingPathComponent:@"test_shell/index.html"]; |
231 // don't use NSURL; it puts a "localhost" bit in that freaks out our URL | 231 // don't use NSURL; it puts a "localhost" bit in that freaks out our URL |
232 // handling | 232 // handling |
233 NSString *testShellURL = [NSString stringWithFormat:@"file://%@", | 233 NSString *testShellURL = [NSString stringWithFormat:@"file://%@", |
234 testShellPath]; | 234 testShellPath]; |
235 uri = UTF8ToWide([testShellURL UTF8String]); | 235 uri = UTF8ToWide([testShellURL UTF8String]); |
236 } | 236 } |
237 | 237 |
238 if (parsed_command_line.GetLooseValueCount() > 0) { | 238 std::vector<std::wstring> values = parsed_command_line.GetLooseValues(); |
239 CommandLine::LooseValueIterator iter = | 239 if (values.size() > 0) |
240 parsed_command_line.GetLooseValuesBegin(); | 240 uri = values[0]; |
241 uri = *iter; | 241 |
242 } | |
243 | |
244 TestShell* shell; | 242 TestShell* shell; |
245 if (TestShell::CreateNewWindow(uri, &shell)) { | 243 if (TestShell::CreateNewWindow(uri, &shell)) { |
246 #ifdef NOTYET | 244 #ifdef NOTYET |
247 if (record_mode || playback_mode) { | 245 if (record_mode || playback_mode) { |
248 // Move the window to the upper left corner for consistent | 246 // Move the window to the upper left corner for consistent |
249 // record/playback mode. For automation, we want this to work | 247 // record/playback mode. For automation, we want this to work |
250 // on build systems where the script invoking us is a background | 248 // on build systems where the script invoking us is a background |
251 // process. So for this case, make our window the topmost window | 249 // process. So for this case, make our window the topmost window |
252 // as well. | 250 // as well. |
253 // ForegroundHelper::SetForeground(shell->mainWnd()); | 251 // ForegroundHelper::SetForeground(shell->mainWnd()); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 if (record_mode) | 337 if (record_mode) |
340 base::EventRecorder::current()->StopRecording(); | 338 base::EventRecorder::current()->StopRecording(); |
341 if (playback_mode) | 339 if (playback_mode) |
342 base::EventRecorder::current()->StopPlayback(); | 340 base::EventRecorder::current()->StopPlayback(); |
343 #endif | 341 #endif |
344 } | 342 } |
345 | 343 |
346 [pool release]; | 344 [pool release]; |
347 return 0; | 345 return 0; |
348 } | 346 } |
OLD | NEW |