OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 32 matching lines...) Loading... |
43 #include "base/file_version_info.h" | 43 #include "base/file_version_info.h" |
44 #include "base/i18n/time_formatting.h" | 44 #include "base/i18n/time_formatting.h" |
45 #include "base/path_service.h" | 45 #include "base/path_service.h" |
46 #include "base/string_number_conversions.h" | 46 #include "base/string_number_conversions.h" |
47 #include "base/string_util.h" | 47 #include "base/string_util.h" |
48 #include "base/test/test_file_util.h" | 48 #include "base/test/test_file_util.h" |
49 #include "base/time.h" | 49 #include "base/time.h" |
50 #include "chrome/browser/browser_thread.h" | 50 #include "chrome/browser/browser_thread.h" |
51 #include "chrome/browser/net/url_fixer_upper.h" | 51 #include "chrome/browser/net/url_fixer_upper.h" |
52 #include "chrome/browser/prefs/pref_service.h" | 52 #include "chrome/browser/prefs/pref_service.h" |
| 53 #include "chrome/browser/prefs/pref_service_mock_builder.h" |
53 #include "chrome/common/automation_messages.h" | 54 #include "chrome/common/automation_messages.h" |
54 #include "chrome/common/chrome_constants.h" | 55 #include "chrome/common/chrome_constants.h" |
55 #include "chrome/common/chrome_paths.h" | 56 #include "chrome/common/chrome_paths.h" |
56 #include "chrome/common/chrome_switches.h" | 57 #include "chrome/common/chrome_switches.h" |
57 #include "chrome/common/chrome_version_info.h" | 58 #include "chrome/common/chrome_version_info.h" |
58 #include "chrome/common/json_pref_store.h" | 59 #include "chrome/common/json_pref_store.h" |
59 #include "chrome/common/logging_chrome.h" | 60 #include "chrome/common/logging_chrome.h" |
60 #include "chrome/common/pref_names.h" | 61 #include "chrome/common/pref_names.h" |
61 #include "chrome/common/url_constants.h" | 62 #include "chrome/common/url_constants.h" |
62 #include "chrome/test/automation/automation_proxy.h" | 63 #include "chrome/test/automation/automation_proxy.h" |
63 #include "chrome/test/automation/browser_proxy.h" | 64 #include "chrome/test/automation/browser_proxy.h" |
64 #include "chrome/test/automation/tab_proxy.h" | 65 #include "chrome/test/automation/tab_proxy.h" |
65 #include "chrome/test/automation/window_proxy.h" | 66 #include "chrome/test/automation/window_proxy.h" |
| 67 #include "chrome/test/reliability/page_load_test.h" |
66 #include "chrome/test/ui/ui_test.h" | 68 #include "chrome/test/ui/ui_test.h" |
67 #include "chrome/test/reliability/page_load_test.h" | |
68 #include "net/base/net_util.h" | 69 #include "net/base/net_util.h" |
69 | 70 |
70 namespace { | 71 namespace { |
71 | 72 |
72 // See comments at the beginning of the file for the definition of switches. | 73 // See comments at the beginning of the file for the definition of switches. |
73 const char kSiteSwitch[] = "site"; | 74 const char kSiteSwitch[] = "site"; |
74 const char kStartPageSwitch[] = "startpage"; | 75 const char kStartPageSwitch[] = "startpage"; |
75 const char kEndPageSwitch[] = "endpage"; | 76 const char kEndPageSwitch[] = "endpage"; |
76 const char kListSwitch[] = "list"; | 77 const char kListSwitch[] = "list"; |
77 const char kStartIndexSwitch[] = "startline"; | 78 const char kStartIndexSwitch[] = "startline"; |
(...skipping 447 matching lines...) Loading... |
525 } | 526 } |
526 } | 527 } |
527 if (metrics) | 528 if (metrics) |
528 metrics->crash_dump_count = num_dumps; | 529 metrics->crash_dump_count = num_dumps; |
529 } | 530 } |
530 | 531 |
531 // Get a PrefService whose contents correspond to the Local State file | 532 // Get a PrefService whose contents correspond to the Local State file |
532 // that was saved by the app as it closed. The caller takes ownership of the | 533 // that was saved by the app as it closed. The caller takes ownership of the |
533 // returned PrefService object. | 534 // returned PrefService object. |
534 PrefService* GetLocalState() { | 535 PrefService* GetLocalState() { |
535 FilePath local_state_path = user_data_dir() | 536 FilePath path = user_data_dir().Append(chrome::kLocalStateFilename); |
536 .Append(chrome::kLocalStateFilename); | 537 return PrefServiceMockBuilder().WithUserFilePrefs(path).Create(); |
537 | |
538 PrefService* local_state = PrefService::CreateUserPrefService( | |
539 local_state_path); | |
540 return local_state; | |
541 } | 538 } |
542 | 539 |
543 void GetStabilityMetrics(NavigationMetrics* metrics) { | 540 void GetStabilityMetrics(NavigationMetrics* metrics) { |
544 if (!metrics) | 541 if (!metrics) |
545 return; | 542 return; |
546 scoped_ptr<PrefService> local_state(GetLocalState()); | 543 scoped_ptr<PrefService> local_state(GetLocalState()); |
547 if (!local_state.get()) | 544 if (!local_state.get()) |
548 return; | 545 return; |
549 local_state->RegisterBooleanPref(prefs::kStabilityExitedCleanly, false); | 546 local_state->RegisterBooleanPref(prefs::kStabilityExitedCleanly, false); |
550 local_state->RegisterIntegerPref(prefs::kStabilityLaunchCount, -1); | 547 local_state->RegisterIntegerPref(prefs::kStabilityLaunchCount, -1); |
(...skipping 168 matching lines...) Loading... |
719 parsed_command_line.GetSwitchValuePath(switches::kJavaScriptFlags)); | 716 parsed_command_line.GetSwitchValuePath(switches::kJavaScriptFlags)); |
720 if (v8_command_line.HasSwitch(kV8LogFileSwitch)) { | 717 if (v8_command_line.HasSwitch(kV8LogFileSwitch)) { |
721 g_v8_log_path = v8_command_line.GetSwitchValuePath(kV8LogFileSwitch); | 718 g_v8_log_path = v8_command_line.GetSwitchValuePath(kV8LogFileSwitch); |
722 if (!file_util::AbsolutePath(&g_v8_log_path)) | 719 if (!file_util::AbsolutePath(&g_v8_log_path)) |
723 g_v8_log_path = FilePath(); | 720 g_v8_log_path = FilePath(); |
724 } | 721 } |
725 } | 722 } |
726 } | 723 } |
727 } | 724 } |
728 } | 725 } |
OLD | NEW |