| 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_util.h" | 10 #include "base/file_util.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 std::wstring page2_path; | 40 std::wstring page2_path; |
| 41 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &page2_path)); | 41 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &page2_path)); |
| 42 file_util::AppendToPath(&page2_path, L"iframe.html"); | 42 file_util::AppendToPath(&page2_path, L"iframe.html"); |
| 43 ASSERT_TRUE(window_->AppendTab(net::FilePathToFileURL(page2_path))); | 43 ASSERT_TRUE(window_->AppendTab(net::FilePathToFileURL(page2_path))); |
| 44 } | 44 } |
| 45 | 45 |
| 46 // Get a PrefService whose contents correspond to the Local State file | 46 // Get a PrefService whose contents correspond to the Local State file |
| 47 // that was saved by the app as it closed. The caller takes ownership of the | 47 // that was saved by the app as it closed. The caller takes ownership of the |
| 48 // returned PrefService object. | 48 // returned PrefService object. |
| 49 PrefService* GetLocalState() { | 49 PrefService* GetLocalState() { |
| 50 std::wstring local_state_path = user_data_dir(); | 50 FilePath local_state_path = FilePath::FromWStringHack(user_data_dir()) |
| 51 file_util::AppendToPath(&local_state_path, chrome::kLocalStateFilename); | 51 .Append(chrome::kLocalStateFilename); |
| 52 | 52 |
| 53 PrefService* local_state(new PrefService(local_state_path)); | 53 PrefService* local_state(new PrefService(local_state_path)); |
| 54 return local_state; | 54 return local_state; |
| 55 } | 55 } |
| 56 | 56 |
| 57 virtual void TearDown() { | 57 virtual void TearDown() { |
| 58 delete window_; | 58 delete window_; |
| 59 UITest::TearDown(); | 59 UITest::TearDown(); |
| 60 } | 60 } |
| 61 | 61 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 local_state->RegisterBooleanPref(prefs::kStabilityExitedCleanly, true); | 103 local_state->RegisterBooleanPref(prefs::kStabilityExitedCleanly, true); |
| 104 local_state->RegisterIntegerPref(prefs::kStabilityLaunchCount, 0); | 104 local_state->RegisterIntegerPref(prefs::kStabilityLaunchCount, 0); |
| 105 local_state->RegisterIntegerPref(prefs::kStabilityPageLoadCount, 0); | 105 local_state->RegisterIntegerPref(prefs::kStabilityPageLoadCount, 0); |
| 106 local_state->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0); | 106 local_state->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0); |
| 107 EXPECT_TRUE(local_state->GetBoolean(prefs::kStabilityExitedCleanly)); | 107 EXPECT_TRUE(local_state->GetBoolean(prefs::kStabilityExitedCleanly)); |
| 108 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityLaunchCount)); | 108 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityLaunchCount)); |
| 109 EXPECT_EQ(3, local_state->GetInteger(prefs::kStabilityPageLoadCount)); | 109 EXPECT_EQ(3, local_state->GetInteger(prefs::kStabilityPageLoadCount)); |
| 110 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityRendererCrashCount)); | 110 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityRendererCrashCount)); |
| 111 } | 111 } |
| 112 | 112 |
| OLD | NEW |