OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This file provides reliablity tests which run for ChromeFrame. | 5 // This file provides reliablity tests which run for ChromeFrame. |
6 // | 6 // |
7 // Usage: | 7 // Usage: |
8 // <reliability test exe> --list=file --startline=start --endline=end [...] | 8 // <reliability test exe> --list=file --startline=start --endline=end [...] |
9 // Upon invocation, it visits each of the URLs on line numbers between start | 9 // Upon invocation, it visits each of the URLs on line numbers between start |
10 // and end, inclusive, stored in the input file. The line number starts from 1. | 10 // and end, inclusive, stored in the input file. The line number starts from 1. |
11 // | 11 // |
12 // Optional Switches: | 12 // Optional Switches: |
13 // --iterations=num: goes through the list of URLs constructed in usage 2 or 3 | 13 // --iterations=num: goes through the list of URLs constructed in usage 2 or 3 |
14 // num times. | 14 // num times. |
15 // --memoryusage: prints out memory usage when visiting each page. | 15 // --memoryusage: prints out memory usage when visiting each page. |
16 // --logfile=filepath: saves the visit log to the specified path. | 16 // --logfile=filepath: saves the visit log to the specified path. |
17 // --timeout=seconds: time out as specified in seconds during each | 17 // --timeout=seconds: time out as specified in seconds during each |
18 // page load. | 18 // page load. |
19 // --nopagedown: won't simulate page down key presses after page load. | 19 // --nopagedown: won't simulate page down key presses after page load. |
20 // --noclearprofile: do not clear profile dir before firing up each time. | 20 // --noclearprofile: do not clear profile dir before firing up each time. |
21 // --savedebuglog: save Chrome, V8, and test debug log for each page loaded. | 21 // --savedebuglog: save Chrome, V8, and test debug log for each page loaded. |
22 #include <fstream> | 22 #include <fstream> |
23 #include <ostream> | 23 #include <ostream> |
24 | 24 |
25 #include "base/command_line.h" | 25 #include "base/command_line.h" |
26 #include "base/file_util.h" | 26 #include "base/file_util.h" |
27 #include "base/file_version_info.h" | 27 #include "base/file_version_info.h" |
28 #include "base/files/file_enumerator.h" | |
29 #include "base/files/file_path.h" | 28 #include "base/files/file_path.h" |
30 #include "base/i18n/time_formatting.h" | 29 #include "base/i18n/time_formatting.h" |
31 #include "base/path_service.h" | 30 #include "base/path_service.h" |
32 #include "base/prefs/json_pref_store.h" | 31 #include "base/prefs/json_pref_store.h" |
33 #include "base/prefs/pref_registry_simple.h" | 32 #include "base/prefs/pref_registry_simple.h" |
34 #include "base/prefs/pref_service.h" | 33 #include "base/prefs/pref_service.h" |
35 #include "base/prefs/pref_value_store.h" | 34 #include "base/prefs/pref_value_store.h" |
36 #include "base/string_number_conversions.h" | 35 #include "base/string_number_conversions.h" |
37 #include "base/string_util.h" | 36 #include "base/string_util.h" |
38 #include "base/test/test_file_util.h" | 37 #include "base/test/test_file_util.h" |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 } | 325 } |
327 } | 326 } |
328 | 327 |
329 file.close(); | 328 file.close(); |
330 } | 329 } |
331 | 330 |
332 protected: | 331 protected: |
333 virtual void SetUp() { | 332 virtual void SetUp() { |
334 // Initialize crash_dumps_dir_path_. | 333 // Initialize crash_dumps_dir_path_. |
335 PathService::Get(chrome::DIR_CRASH_DUMPS, &crash_dumps_dir_path_); | 334 PathService::Get(chrome::DIR_CRASH_DUMPS, &crash_dumps_dir_path_); |
336 base::FileEnumerator enumerator(crash_dumps_dir_path_, | 335 file_util::FileEnumerator enumerator(crash_dumps_dir_path_, |
337 false, // not recursive | 336 false, // not recursive |
338 base::FileEnumerator::FILES); | 337 file_util::FileEnumerator::FILES); |
339 for (base::FilePath path = enumerator.Next(); !path.value().empty(); | 338 for (base::FilePath path = enumerator.Next(); !path.value().empty(); |
340 path = enumerator.Next()) { | 339 path = enumerator.Next()) { |
341 if (path.MatchesExtension(FILE_PATH_LITERAL(".dmp"))) | 340 if (path.MatchesExtension(FILE_PATH_LITERAL(".dmp"))) |
342 crash_dumps_[path.BaseName()] = true; | 341 crash_dumps_[path.BaseName()] = true; |
343 } | 342 } |
344 | 343 |
345 if (g_clear_profile) { | 344 if (g_clear_profile) { |
346 base::FilePath user_data_dir; | 345 base::FilePath user_data_dir; |
347 chrome::GetChromeFrameUserDataDirectory(&user_data_dir); | 346 chrome::GetChromeFrameUserDataDirectory(&user_data_dir); |
348 ASSERT_TRUE(file_util::DieFileDie(user_data_dir, true)); | 347 ASSERT_TRUE(file_util::DieFileDie(user_data_dir, true)); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 } | 404 } |
406 } | 405 } |
407 | 406 |
408 // Check whether there are new .dmp files. Additionally, write | 407 // Check whether there are new .dmp files. Additionally, write |
409 // " crash_dump=<full path name of the .dmp file>" | 408 // " crash_dump=<full path name of the .dmp file>" |
410 // to log_file. | 409 // to log_file. |
411 void LogOrDeleteNewCrashDumps(std::ofstream& log_file, | 410 void LogOrDeleteNewCrashDumps(std::ofstream& log_file, |
412 NavigationMetrics* metrics) { | 411 NavigationMetrics* metrics) { |
413 int num_dumps = 0; | 412 int num_dumps = 0; |
414 | 413 |
415 base::FileEnumerator enumerator(crash_dumps_dir_path_, | 414 file_util::FileEnumerator enumerator(crash_dumps_dir_path_, |
416 false, // not recursive | 415 false, // not recursive |
417 base::FileEnumerator::FILES); | 416 file_util::FileEnumerator::FILES); |
418 for (base::FilePath path = enumerator.Next(); !path.value().empty(); | 417 for (base::FilePath path = enumerator.Next(); !path.value().empty(); |
419 path = enumerator.Next()) { | 418 path = enumerator.Next()) { |
420 if (path.MatchesExtension(FILE_PATH_LITERAL(".dmp")) && | 419 if (path.MatchesExtension(FILE_PATH_LITERAL(".dmp")) && |
421 !crash_dumps_[path.BaseName()]) { | 420 !crash_dumps_[path.BaseName()]) { |
422 LogOrDeleteCrashDump(log_file, path.BaseName()); | 421 LogOrDeleteCrashDump(log_file, path.BaseName()); |
423 num_dumps++; | 422 num_dumps++; |
424 } | 423 } |
425 } | 424 } |
426 if (metrics) | 425 if (metrics) |
427 metrics->crash_dump_count = num_dumps; | 426 metrics->crash_dump_count = num_dumps; |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 CommandLine v8_command_line( | 587 CommandLine v8_command_line( |
589 parsed_command_line.GetSwitchValuePath(switches::kJavaScriptFlags)); | 588 parsed_command_line.GetSwitchValuePath(switches::kJavaScriptFlags)); |
590 if (v8_command_line.HasSwitch(kV8LogFileSwitch)) { | 589 if (v8_command_line.HasSwitch(kV8LogFileSwitch)) { |
591 g_v8_log_path = base::MakeAbsoluteFilePath( | 590 g_v8_log_path = base::MakeAbsoluteFilePath( |
592 v8_command_line.GetSwitchValuePath(kV8LogFileSwitch)); | 591 v8_command_line.GetSwitchValuePath(kV8LogFileSwitch)); |
593 } | 592 } |
594 } | 593 } |
595 } | 594 } |
596 } | 595 } |
597 } | 596 } |
OLD | NEW |