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 test which runs under UI test framework. The | 5 // This file provides reliablity test which runs under UI test framework. The |
6 // test is intended to run within QEMU environment. | 6 // test is intended to run within QEMU environment. |
7 // | 7 // |
8 // Usage 1: reliability_test | 8 // Usage 1: reliability_test |
9 // Upon invocation, it visits a hard coded list of sample URLs. This is mainly | 9 // Upon invocation, it visits a hard coded list of sample URLs. This is mainly |
10 // used by buildbot, to verify reliability_test itself runs ok. | 10 // used by buildbot, to verify reliability_test itself runs ok. |
(...skipping 23 matching lines...) Expand all Loading... |
34 // --searchdumpsbypid: Look for crash dumps by browser process id. | 34 // --searchdumpsbypid: Look for crash dumps by browser process id. |
35 // "crash_dir/pid/" | 35 // "crash_dir/pid/" |
36 | 36 |
37 #include <fstream> | 37 #include <fstream> |
38 #include <vector> | 38 #include <vector> |
39 | 39 |
40 #include "base/command_line.h" | 40 #include "base/command_line.h" |
41 #include "base/environment.h" | 41 #include "base/environment.h" |
42 #include "base/file_util.h" | 42 #include "base/file_util.h" |
43 #include "base/file_version_info.h" | 43 #include "base/file_version_info.h" |
44 #include "base/files/file_enumerator.h" | |
45 #include "base/files/file_path.h" | 44 #include "base/files/file_path.h" |
46 #include "base/i18n/time_formatting.h" | 45 #include "base/i18n/time_formatting.h" |
47 #include "base/memory/scoped_ptr.h" | 46 #include "base/memory/scoped_ptr.h" |
48 #include "base/path_service.h" | 47 #include "base/path_service.h" |
49 #include "base/prefs/json_pref_store.h" | 48 #include "base/prefs/json_pref_store.h" |
50 #include "base/prefs/pref_registry_simple.h" | 49 #include "base/prefs/pref_registry_simple.h" |
51 #include "base/prefs/pref_service.h" | 50 #include "base/prefs/pref_service.h" |
52 #include "base/string_util.h" | 51 #include "base/string_util.h" |
53 #include "base/strings/string_number_conversions.h" | 52 #include "base/strings/string_number_conversions.h" |
54 #include "base/test/test_file_util.h" | 53 #include "base/test/test_file_util.h" |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 // If 'BREAKPAD_DUMP_LOCATION' environment variable is set, use it instead. | 629 // If 'BREAKPAD_DUMP_LOCATION' environment variable is set, use it instead. |
631 scoped_ptr<base::Environment> env(base::Environment::Create()); | 630 scoped_ptr<base::Environment> env(base::Environment::Create()); |
632 std::string alternate_minidump_location; | 631 std::string alternate_minidump_location; |
633 if (env->GetVar("BREAKPAD_DUMP_LOCATION", &alternate_minidump_location)) { | 632 if (env->GetVar("BREAKPAD_DUMP_LOCATION", &alternate_minidump_location)) { |
634 crash_dumps_dir_path_ = base::FilePath::FromUTF8Unsafe( | 633 crash_dumps_dir_path_ = base::FilePath::FromUTF8Unsafe( |
635 alternate_minidump_location); | 634 alternate_minidump_location); |
636 } else { | 635 } else { |
637 PathService::Get(chrome::DIR_CRASH_DUMPS, &crash_dumps_dir_path_); | 636 PathService::Get(chrome::DIR_CRASH_DUMPS, &crash_dumps_dir_path_); |
638 } | 637 } |
639 | 638 |
640 base::FileEnumerator enumerator(crash_dumps_dir_path_, | 639 file_util::FileEnumerator enumerator(crash_dumps_dir_path_, |
641 false, // not recursive | 640 false, // not recursive |
642 base::FileEnumerator::FILES); | 641 file_util::FileEnumerator::FILES); |
643 for (base::FilePath path = enumerator.Next(); !path.value().empty(); | 642 for (base::FilePath path = enumerator.Next(); !path.value().empty(); |
644 path = enumerator.Next()) { | 643 path = enumerator.Next()) { |
645 if (path.MatchesExtension(FILE_PATH_LITERAL(".dmp"))) | 644 if (path.MatchesExtension(FILE_PATH_LITERAL(".dmp"))) |
646 crash_dumps_[path.BaseName()] = true; | 645 crash_dumps_[path.BaseName()] = true; |
647 } | 646 } |
648 } | 647 } |
649 | 648 |
650 base::FilePath ConstructSavedDebugLogPath( | 649 base::FilePath ConstructSavedDebugLogPath( |
651 const base::FilePath& debug_log_path, | 650 const base::FilePath& debug_log_path, |
652 int index) { | 651 int index) { |
(...skipping 28 matching lines...) Expand all Loading... |
681 base::FilePath crash_dump_file_path(crash_dumps_dir_path_); | 680 base::FilePath crash_dump_file_path(crash_dumps_dir_path_); |
682 crash_dump_file_path = crash_dump_file_path.Append(crash_dump_file_name); | 681 crash_dump_file_path = crash_dump_file_path.Append(crash_dump_file_name); |
683 base::FilePath crash_text_file_path = | 682 base::FilePath crash_text_file_path = |
684 crash_dump_file_path.ReplaceExtension(FILE_PATH_LITERAL("txt")); | 683 crash_dump_file_path.ReplaceExtension(FILE_PATH_LITERAL("txt")); |
685 | 684 |
686 ASSERT_TRUE(file_util::DieFileDie(crash_dump_file_path, false)); | 685 ASSERT_TRUE(file_util::DieFileDie(crash_dump_file_path, false)); |
687 ASSERT_TRUE(file_util::DieFileDie(crash_text_file_path, false)); | 686 ASSERT_TRUE(file_util::DieFileDie(crash_text_file_path, false)); |
688 } | 687 } |
689 | 688 |
690 bool HasNewCrashDumps() { | 689 bool HasNewCrashDumps() { |
691 base::FileEnumerator enumerator(crash_dumps_dir_path_, | 690 file_util::FileEnumerator enumerator(crash_dumps_dir_path_, |
692 false, // not recursive | 691 false, // not recursive |
693 base::FileEnumerator::FILES); | 692 file_util::FileEnumerator::FILES); |
694 for (base::FilePath path = enumerator.Next(); !path.value().empty(); | 693 for (base::FilePath path = enumerator.Next(); !path.value().empty(); |
695 path = enumerator.Next()) { | 694 path = enumerator.Next()) { |
696 if (path.MatchesExtension(FILE_PATH_LITERAL(".dmp")) && | 695 if (path.MatchesExtension(FILE_PATH_LITERAL(".dmp")) && |
697 !crash_dumps_[path.BaseName()]) { | 696 !crash_dumps_[path.BaseName()]) { |
698 return true; | 697 return true; |
699 } | 698 } |
700 } | 699 } |
701 | 700 |
702 return false; | 701 return false; |
703 } | 702 } |
704 | 703 |
705 // Check whether there are new .dmp files. Return the list and optionally | 704 // Check whether there are new .dmp files. Return the list and optionally |
706 // delete them afterwards. | 705 // delete them afterwards. |
707 void CollectNewCrashDumps(std::vector<base::FilePath>& new_crash_dumps, | 706 void CollectNewCrashDumps(std::vector<base::FilePath>& new_crash_dumps, |
708 NavigationMetrics* metrics, | 707 NavigationMetrics* metrics, |
709 bool delete_dumps) { | 708 bool delete_dumps) { |
710 int num_dumps = 0; | 709 int num_dumps = 0; |
711 base::FileEnumerator enumerator(crash_dumps_dir_path_, | 710 file_util::FileEnumerator enumerator(crash_dumps_dir_path_, |
712 false, // not recursive | 711 false, // not recursive |
713 base::FileEnumerator::FILES); | 712 file_util::FileEnumerator::FILES); |
714 for (base::FilePath path = enumerator.Next(); !path.value().empty(); | 713 for (base::FilePath path = enumerator.Next(); !path.value().empty(); |
715 path = enumerator.Next()) { | 714 path = enumerator.Next()) { |
716 if (path.MatchesExtension(FILE_PATH_LITERAL(".dmp")) && | 715 if (path.MatchesExtension(FILE_PATH_LITERAL(".dmp")) && |
717 !crash_dumps_[path.BaseName()]) { | 716 !crash_dumps_[path.BaseName()]) { |
718 crash_dumps_[path.BaseName()] = true; | 717 crash_dumps_[path.BaseName()] = true; |
719 base::FilePath crash_dump_file_path(crash_dumps_dir_path_); | 718 base::FilePath crash_dump_file_path(crash_dumps_dir_path_); |
720 crash_dump_file_path = crash_dump_file_path.Append(path.BaseName()); | 719 crash_dump_file_path = crash_dump_file_path.Append(path.BaseName()); |
721 new_crash_dumps.push_back(crash_dump_file_path); | 720 new_crash_dumps.push_back(crash_dump_file_path); |
722 if (delete_dumps) | 721 if (delete_dumps) |
723 DeleteCrashDump(path.BaseName()); | 722 DeleteCrashDump(path.BaseName()); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 if (!g_end_url.empty()) { | 810 if (!g_end_url.empty()) { |
812 NavigateToURLLogResult( | 811 NavigateToURLLogResult( |
813 g_end_url, log_file, NULL, g_continuous_load, false); | 812 g_end_url, log_file, NULL, g_continuous_load, false); |
814 } | 813 } |
815 | 814 |
816 log_file.close(); | 815 log_file.close(); |
817 } | 816 } |
818 | 817 |
819 } // namespace | 818 } // namespace |
820 | 819 |
OLD | NEW |