| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/at_exit.h" | 5 #include "base/at_exit.h" |
| 6 #include "base/basictypes.h" | 6 #include "base/basictypes.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/environment.h" | 9 #include "base/environment.h" |
| 10 #include "base/event_recorder.h" | 10 #include "base/event_recorder.h" |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 FilePath script_path = cache_path; | 318 FilePath script_path = cache_path; |
| 319 // Create the cache directory in case it doesn't exist. | 319 // Create the cache directory in case it doesn't exist. |
| 320 file_util::CreateDirectory(cache_path); | 320 file_util::CreateDirectory(cache_path); |
| 321 script_path = script_path.AppendASCII("script.log"); | 321 script_path = script_path.AppendASCII("script.log"); |
| 322 if (record_mode) | 322 if (record_mode) |
| 323 base::EventRecorder::current()->StartRecording(script_path); | 323 base::EventRecorder::current()->StartRecording(script_path); |
| 324 if (playback_mode) | 324 if (playback_mode) |
| 325 base::EventRecorder::current()->StartPlayback(script_path); | 325 base::EventRecorder::current()->StartPlayback(script_path); |
| 326 } | 326 } |
| 327 | 327 |
| 328 if (parsed_command_line.HasSwitch(test_shell::kDebugMemoryInUse)) { | |
| 329 base::MemoryDebug::SetMemoryInUseEnabled(true); | |
| 330 // Dump all in use memory at startup | |
| 331 base::MemoryDebug::DumpAllMemoryInUse(); | |
| 332 } | |
| 333 | |
| 334 webkit_glue::SetJavaScriptFlags(TestShell::GetJSFlagsForLoad(0)); | 328 webkit_glue::SetJavaScriptFlags(TestShell::GetJSFlagsForLoad(0)); |
| 335 MessageLoop::current()->Run(); | 329 MessageLoop::current()->Run(); |
| 336 | 330 |
| 337 if (record_mode) | 331 if (record_mode) |
| 338 base::EventRecorder::current()->StopRecording(); | 332 base::EventRecorder::current()->StopRecording(); |
| 339 if (playback_mode) | 333 if (playback_mode) |
| 340 base::EventRecorder::current()->StopPlayback(); | 334 base::EventRecorder::current()->StopPlayback(); |
| 341 } | 335 } |
| 342 | 336 |
| 343 TestShell::ShutdownTestShell(); | 337 TestShell::ShutdownTestShell(); |
| 344 TestShell::CleanupLogging(); | 338 TestShell::CleanupLogging(); |
| 345 | 339 |
| 346 // Tear down shared StatsTable; prevents unit_tests from leaking it. | 340 // Tear down shared StatsTable; prevents unit_tests from leaking it. |
| 347 base::StatsTable::set_current(NULL); | 341 base::StatsTable::set_current(NULL); |
| 348 delete table; | 342 delete table; |
| 349 RemoveSharedMemoryFile(stats_filename); | 343 RemoveSharedMemoryFile(stats_filename); |
| 350 | 344 |
| 351 return 0; | 345 return 0; |
| 352 } | 346 } |
| OLD | NEW |