| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 ASSERT_TRUE(window_->AppendTab(net::FilePathToFileURL(page2_path))); | 45 ASSERT_TRUE(window_->AppendTab(net::FilePathToFileURL(page2_path))); |
| 46 } | 46 } |
| 47 | 47 |
| 48 // Get a PrefService whose contents correspond to the Local State file | 48 // Get a PrefService whose contents correspond to the Local State file |
| 49 // that was saved by the app as it closed. The caller takes ownership of the | 49 // that was saved by the app as it closed. The caller takes ownership of the |
| 50 // returned PrefService object. | 50 // returned PrefService object. |
| 51 PrefService* GetLocalState() { | 51 PrefService* GetLocalState() { |
| 52 FilePath local_state_path = user_data_dir() | 52 FilePath local_state_path = user_data_dir() |
| 53 .Append(chrome::kLocalStateFilename); | 53 .Append(chrome::kLocalStateFilename); |
| 54 | 54 |
| 55 PrefService* local_state(new PrefService(local_state_path)); | 55 PrefService* local_state(new PrefService(local_state_path, NULL)); |
| 56 return local_state; | 56 return local_state; |
| 57 } | 57 } |
| 58 | 58 |
| 59 virtual void TearDown() { | 59 virtual void TearDown() { |
| 60 delete window_; | 60 delete window_; |
| 61 UITest::TearDown(); | 61 UITest::TearDown(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 protected: | 64 protected: |
| 65 BrowserProxy* window_; | 65 BrowserProxy* window_; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 scoped_ptr<PrefService> local_state(GetLocalState()); | 107 scoped_ptr<PrefService> local_state(GetLocalState()); |
| 108 local_state->RegisterBooleanPref(prefs::kStabilityExitedCleanly, true); | 108 local_state->RegisterBooleanPref(prefs::kStabilityExitedCleanly, true); |
| 109 local_state->RegisterIntegerPref(prefs::kStabilityLaunchCount, 0); | 109 local_state->RegisterIntegerPref(prefs::kStabilityLaunchCount, 0); |
| 110 local_state->RegisterIntegerPref(prefs::kStabilityPageLoadCount, 0); | 110 local_state->RegisterIntegerPref(prefs::kStabilityPageLoadCount, 0); |
| 111 local_state->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0); | 111 local_state->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0); |
| 112 EXPECT_TRUE(local_state->GetBoolean(prefs::kStabilityExitedCleanly)); | 112 EXPECT_TRUE(local_state->GetBoolean(prefs::kStabilityExitedCleanly)); |
| 113 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityLaunchCount)); | 113 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityLaunchCount)); |
| 114 EXPECT_EQ(3, local_state->GetInteger(prefs::kStabilityPageLoadCount)); | 114 EXPECT_EQ(3, local_state->GetInteger(prefs::kStabilityPageLoadCount)); |
| 115 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityRendererCrashCount)); | 115 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityRendererCrashCount)); |
| 116 } | 116 } |
| OLD | NEW |