| 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 // 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 #include "webkit/tools/test_shell/test_shell_switches.h" | 47 #include "webkit/tools/test_shell/test_shell_switches.h" |
| 48 | 48 |
| 49 #include <iostream> | 49 #include <iostream> |
| 50 using namespace std; | 50 using namespace std; |
| 51 | 51 |
| 52 static const size_t kPathBufSize = 2048; | 52 static const size_t kPathBufSize = 2048; |
| 53 | 53 |
| 54 namespace { | 54 namespace { |
| 55 | 55 |
| 56 // StatsTable initialization parameters. | 56 // StatsTable initialization parameters. |
| 57 static const wchar_t* kStatsFilePrefix = L"testshell_"; | 57 static const char* kStatsFilePrefix = "testshell_"; |
| 58 static int kStatsFileThreads = 20; | 58 static int kStatsFileThreads = 20; |
| 59 static int kStatsFileCounters = 200; | 59 static int kStatsFileCounters = 200; |
| 60 | 60 |
| 61 #if defined(OS_WIN) | 61 #if defined(OS_WIN) |
| 62 StringPiece GetRawDataResource(HMODULE module, int resource_id) { | 62 StringPiece GetRawDataResource(HMODULE module, int resource_id) { |
| 63 void* data_ptr; | 63 void* data_ptr; |
| 64 size_t data_size; | 64 size_t data_size; |
| 65 return base::GetDataResourceFromModule(module, resource_id, &data_ptr, | 65 return base::GetDataResourceFromModule(module, resource_id, &data_ptr, |
| 66 &data_size) ? | 66 &data_size) ? |
| 67 StringPiece(static_cast<char*>(data_ptr), data_size) : StringPiece(); | 67 StringPiece(static_cast<char*>(data_ptr), data_size) : StringPiece(); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 parsed_command_line.GetSwitchValue(test_shell::kJavaScriptFlags); | 211 parsed_command_line.GetSwitchValue(test_shell::kJavaScriptFlags); |
| 212 // Test shell always exposes the GC. | 212 // Test shell always exposes the GC. |
| 213 CommandLine::AppendSwitch(&js_flags, L"expose-gc"); | 213 CommandLine::AppendSwitch(&js_flags, L"expose-gc"); |
| 214 webkit_glue::SetJavaScriptFlags(js_flags); | 214 webkit_glue::SetJavaScriptFlags(js_flags); |
| 215 // Also expose GCController to JavaScript. | 215 // Also expose GCController to JavaScript. |
| 216 webkit_glue::SetShouldExposeGCController(true); | 216 webkit_glue::SetShouldExposeGCController(true); |
| 217 | 217 |
| 218 // Load and initialize the stats table. Attempt to construct a somewhat | 218 // Load and initialize the stats table. Attempt to construct a somewhat |
| 219 // unique name to isolate separate instances from each other. | 219 // unique name to isolate separate instances from each other. |
| 220 StatsTable *table = new StatsTable( | 220 StatsTable *table = new StatsTable( |
| 221 kStatsFilePrefix + Uint64ToWString(base::RandUint64()), | 221 kStatsFilePrefix + Uint64ToString(base::RandUint64()), |
| 222 kStatsFileThreads, | 222 kStatsFileThreads, |
| 223 kStatsFileCounters); | 223 kStatsFileCounters); |
| 224 StatsTable::set_current(table); | 224 StatsTable::set_current(table); |
| 225 | 225 |
| 226 TestShell* shell; | 226 TestShell* shell; |
| 227 if (TestShell::CreateNewWindow(uri, &shell)) { | 227 if (TestShell::CreateNewWindow(uri, &shell)) { |
| 228 #if defined(OS_WIN) | 228 #if defined(OS_WIN) |
| 229 if (record_mode || playback_mode) { | 229 if (record_mode || playback_mode) { |
| 230 // Move the window to the upper left corner for consistent | 230 // Move the window to the upper left corner for consistent |
| 231 // record/playback mode. For automation, we want this to work | 231 // record/playback mode. For automation, we want this to work |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 | 325 |
| 326 // Tear down shared StatsTable; prevents unit_tests from leaking it. | 326 // Tear down shared StatsTable; prevents unit_tests from leaking it. |
| 327 StatsTable::set_current(NULL); | 327 StatsTable::set_current(NULL); |
| 328 delete table; | 328 delete table; |
| 329 | 329 |
| 330 #ifdef _CRTDBG_MAP_ALLOC | 330 #ifdef _CRTDBG_MAP_ALLOC |
| 331 _CrtDumpMemoryLeaks(); | 331 _CrtDumpMemoryLeaks(); |
| 332 #endif | 332 #endif |
| 333 return 0; | 333 return 0; |
| 334 } | 334 } |
| OLD | NEW |