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" |
28 #include "base/files/file_path.h" | 29 #include "base/files/file_path.h" |
29 #include "base/i18n/time_formatting.h" | 30 #include "base/i18n/time_formatting.h" |
30 #include "base/path_service.h" | 31 #include "base/path_service.h" |
31 #include "base/prefs/json_pref_store.h" | 32 #include "base/prefs/json_pref_store.h" |
32 #include "base/prefs/pref_registry_simple.h" | 33 #include "base/prefs/pref_registry_simple.h" |
33 #include "base/prefs/pref_service.h" | 34 #include "base/prefs/pref_service.h" |
34 #include "base/prefs/pref_value_store.h" | 35 #include "base/prefs/pref_value_store.h" |
35 #include "base/string_number_conversions.h" | 36 #include "base/string_number_conversions.h" |
36 #include "base/string_util.h" | 37 #include "base/string_util.h" |
37 #include "base/test/test_file_util.h" | 38 #include "base/test/test_file_util.h" |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 } | 326 } |
326 } | 327 } |
327 | 328 |
328 file.close(); | 329 file.close(); |
329 } | 330 } |
330 | 331 |
331 protected: | 332 protected: |
332 virtual void SetUp() { | 333 virtual void SetUp() { |
333 // Initialize crash_dumps_dir_path_. | 334 // Initialize crash_dumps_dir_path_. |
334 PathService::Get(chrome::DIR_CRASH_DUMPS, &crash_dumps_dir_path_); | 335 PathService::Get(chrome::DIR_CRASH_DUMPS, &crash_dumps_dir_path_); |
335 file_util::FileEnumerator enumerator(crash_dumps_dir_path_, | 336 base::FileEnumerator enumerator(crash_dumps_dir_path_, |
336 false, // not recursive | 337 false, // not recursive |
337 file_util::FileEnumerator::FILES); | 338 base::FileEnumerator::FILES); |
338 for (base::FilePath path = enumerator.Next(); !path.value().empty(); | 339 for (base::FilePath path = enumerator.Next(); !path.value().empty(); |
339 path = enumerator.Next()) { | 340 path = enumerator.Next()) { |
340 if (path.MatchesExtension(FILE_PATH_LITERAL(".dmp"))) | 341 if (path.MatchesExtension(FILE_PATH_LITERAL(".dmp"))) |
341 crash_dumps_[path.BaseName()] = true; | 342 crash_dumps_[path.BaseName()] = true; |
342 } | 343 } |
343 | 344 |
344 if (g_clear_profile) { | 345 if (g_clear_profile) { |
345 base::FilePath user_data_dir; | 346 base::FilePath user_data_dir; |
346 chrome::GetChromeFrameUserDataDirectory(&user_data_dir); | 347 chrome::GetChromeFrameUserDataDirectory(&user_data_dir); |
347 ASSERT_TRUE(file_util::DieFileDie(user_data_dir, true)); | 348 ASSERT_TRUE(file_util::DieFileDie(user_data_dir, true)); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 } | 405 } |
405 } | 406 } |
406 | 407 |
407 // Check whether there are new .dmp files. Additionally, write | 408 // Check whether there are new .dmp files. Additionally, write |
408 // " crash_dump=<full path name of the .dmp file>" | 409 // " crash_dump=<full path name of the .dmp file>" |
409 // to log_file. | 410 // to log_file. |
410 void LogOrDeleteNewCrashDumps(std::ofstream& log_file, | 411 void LogOrDeleteNewCrashDumps(std::ofstream& log_file, |
411 NavigationMetrics* metrics) { | 412 NavigationMetrics* metrics) { |
412 int num_dumps = 0; | 413 int num_dumps = 0; |
413 | 414 |
414 file_util::FileEnumerator enumerator(crash_dumps_dir_path_, | 415 base::FileEnumerator enumerator(crash_dumps_dir_path_, |
415 false, // not recursive | 416 false, // not recursive |
416 file_util::FileEnumerator::FILES); | 417 base::FileEnumerator::FILES); |
417 for (base::FilePath path = enumerator.Next(); !path.value().empty(); | 418 for (base::FilePath path = enumerator.Next(); !path.value().empty(); |
418 path = enumerator.Next()) { | 419 path = enumerator.Next()) { |
419 if (path.MatchesExtension(FILE_PATH_LITERAL(".dmp")) && | 420 if (path.MatchesExtension(FILE_PATH_LITERAL(".dmp")) && |
420 !crash_dumps_[path.BaseName()]) { | 421 !crash_dumps_[path.BaseName()]) { |
421 LogOrDeleteCrashDump(log_file, path.BaseName()); | 422 LogOrDeleteCrashDump(log_file, path.BaseName()); |
422 num_dumps++; | 423 num_dumps++; |
423 } | 424 } |
424 } | 425 } |
425 if (metrics) | 426 if (metrics) |
426 metrics->crash_dump_count = num_dumps; | 427 metrics->crash_dump_count = num_dumps; |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 CommandLine v8_command_line( | 588 CommandLine v8_command_line( |
588 parsed_command_line.GetSwitchValuePath(switches::kJavaScriptFlags)); | 589 parsed_command_line.GetSwitchValuePath(switches::kJavaScriptFlags)); |
589 if (v8_command_line.HasSwitch(kV8LogFileSwitch)) { | 590 if (v8_command_line.HasSwitch(kV8LogFileSwitch)) { |
590 g_v8_log_path = base::MakeAbsoluteFilePath( | 591 g_v8_log_path = base::MakeAbsoluteFilePath( |
591 v8_command_line.GetSwitchValuePath(kV8LogFileSwitch)); | 592 v8_command_line.GetSwitchValuePath(kV8LogFileSwitch)); |
592 } | 593 } |
593 } | 594 } |
594 } | 595 } |
595 } | 596 } |
596 } | 597 } |
OLD | NEW |