| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Tests the MetricsService stat recording to make sure that the numbers are | 5 // Tests the MetricsService stat recording to make sure that the numbers are |
| 6 // what we expect. | 6 // what we expect. |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "base/test/test_timeouts.h" |
| 13 #include "base/threading/platform_thread.h" | 14 #include "base/threading/platform_thread.h" |
| 14 #include "chrome/browser/prefs/pref_service.h" | 15 #include "chrome/browser/prefs/pref_service.h" |
| 15 #include "chrome/browser/prefs/pref_service_mock_builder.h" | 16 #include "chrome/browser/prefs/pref_service_mock_builder.h" |
| 16 #include "chrome/browser/prefs/pref_value_store.h" | 17 #include "chrome/browser/prefs/pref_value_store.h" |
| 17 #include "chrome/common/chrome_constants.h" | 18 #include "chrome/common/chrome_constants.h" |
| 18 #include "chrome/common/chrome_paths.h" | 19 #include "chrome/common/chrome_paths.h" |
| 19 #include "chrome/common/json_pref_store.h" | 20 #include "chrome/common/json_pref_store.h" |
| 20 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
| 21 #include "chrome/common/url_constants.h" | 22 #include "chrome/common/url_constants.h" |
| 22 #include "chrome/test/automation/browser_proxy.h" | 23 #include "chrome/test/automation/browser_proxy.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 // We can get crash dumps on Windows always, Linux when breakpad is | 93 // We can get crash dumps on Windows always, Linux when breakpad is |
| 93 // enabled, and all platforms for official Google Chrome builds. | 94 // enabled, and all platforms for official Google Chrome builds. |
| 94 #if defined(OS_WIN) || defined(USE_LINUX_BREAKPAD) || \ | 95 #if defined(OS_WIN) || defined(USE_LINUX_BREAKPAD) || \ |
| 95 defined(GOOGLE_CHROME_BUILD) | 96 defined(GOOGLE_CHROME_BUILD) |
| 96 expected_crashes_ = 1; | 97 expected_crashes_ = 1; |
| 97 #endif | 98 #endif |
| 98 ASSERT_TRUE(tab->NavigateToURLAsync(GURL(chrome::kAboutCrashURL))); | 99 ASSERT_TRUE(tab->NavigateToURLAsync(GURL(chrome::kAboutCrashURL))); |
| 99 } | 100 } |
| 100 | 101 |
| 101 // Give the browser a chance to notice the crashed tab. | 102 // Give the browser a chance to notice the crashed tab. |
| 102 base::PlatformThread::Sleep(sleep_timeout_ms()); | 103 base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms()); |
| 103 | 104 |
| 104 QuitBrowser(); | 105 QuitBrowser(); |
| 105 | 106 |
| 106 scoped_ptr<PrefService> local_state(GetLocalState()); | 107 scoped_ptr<PrefService> local_state(GetLocalState()); |
| 107 local_state->RegisterBooleanPref(prefs::kStabilityExitedCleanly, true); | 108 local_state->RegisterBooleanPref(prefs::kStabilityExitedCleanly, true); |
| 108 local_state->RegisterIntegerPref(prefs::kStabilityLaunchCount, 0); | 109 local_state->RegisterIntegerPref(prefs::kStabilityLaunchCount, 0); |
| 109 local_state->RegisterIntegerPref(prefs::kStabilityPageLoadCount, 0); | 110 local_state->RegisterIntegerPref(prefs::kStabilityPageLoadCount, 0); |
| 110 local_state->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0); | 111 local_state->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0); |
| 111 EXPECT_TRUE(local_state->GetBoolean(prefs::kStabilityExitedCleanly)); | 112 EXPECT_TRUE(local_state->GetBoolean(prefs::kStabilityExitedCleanly)); |
| 112 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityLaunchCount)); | 113 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityLaunchCount)); |
| 113 EXPECT_EQ(4, local_state->GetInteger(prefs::kStabilityPageLoadCount)); | 114 EXPECT_EQ(4, local_state->GetInteger(prefs::kStabilityPageLoadCount)); |
| 114 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityRendererCrashCount)); | 115 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityRendererCrashCount)); |
| 115 } | 116 } |
| OLD | NEW |