| OLD | NEW |
| 1 // Copyright (c) 2011 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" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 MetricsServiceTest() : UITest() { | 32 MetricsServiceTest() : UITest() { |
| 33 // We need to show the window so web content type tabs load. | 33 // We need to show the window so web content type tabs load. |
| 34 show_window_ = true; | 34 show_window_ = true; |
| 35 } | 35 } |
| 36 | 36 |
| 37 // Open a few tabs of random content | 37 // Open a few tabs of random content |
| 38 void OpenTabs() { | 38 void OpenTabs() { |
| 39 scoped_refptr<BrowserProxy> window = automation()->GetBrowserWindow(0); | 39 scoped_refptr<BrowserProxy> window = automation()->GetBrowserWindow(0); |
| 40 ASSERT_TRUE(window.get()); | 40 ASSERT_TRUE(window.get()); |
| 41 | 41 |
| 42 // The Instant field trial causes a preload of the default search engine, | |
| 43 // which messes up the expected page load count. Setting this preference | |
| 44 // disables the field trial. | |
| 45 ASSERT_TRUE(window->SetBooleanPreference(prefs::kInstantEnabledOnce, true)); | |
| 46 | |
| 47 FilePath page1_path; | 42 FilePath page1_path; |
| 48 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &page1_path)); | 43 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &page1_path)); |
| 49 page1_path = page1_path.AppendASCII("title2.html"); | 44 page1_path = page1_path.AppendASCII("title2.html"); |
| 50 ASSERT_TRUE(window->AppendTab(net::FilePathToFileURL(page1_path))); | 45 ASSERT_TRUE(window->AppendTab(net::FilePathToFileURL(page1_path))); |
| 51 | 46 |
| 52 FilePath page2_path; | 47 FilePath page2_path; |
| 53 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &page2_path)); | 48 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &page2_path)); |
| 54 page2_path = page2_path.AppendASCII("iframe.html"); | 49 page2_path = page2_path.AppendASCII("iframe.html"); |
| 55 ASSERT_TRUE(window->AppendTab(net::FilePathToFileURL(page2_path))); | 50 ASSERT_TRUE(window->AppendTab(net::FilePathToFileURL(page2_path))); |
| 56 } | 51 } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 EXPECT_TRUE(local_state->GetBoolean(prefs::kStabilityExitedCleanly)); | 115 EXPECT_TRUE(local_state->GetBoolean(prefs::kStabilityExitedCleanly)); |
| 121 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityLaunchCount)); | 116 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityLaunchCount)); |
| 122 #if defined(TOUCH_UI) | 117 #if defined(TOUCH_UI) |
| 123 // The keyboard page loads for touchui. | 118 // The keyboard page loads for touchui. |
| 124 EXPECT_EQ(5, local_state->GetInteger(prefs::kStabilityPageLoadCount)); | 119 EXPECT_EQ(5, local_state->GetInteger(prefs::kStabilityPageLoadCount)); |
| 125 #else | 120 #else |
| 126 EXPECT_EQ(4, local_state->GetInteger(prefs::kStabilityPageLoadCount)); | 121 EXPECT_EQ(4, local_state->GetInteger(prefs::kStabilityPageLoadCount)); |
| 127 #endif | 122 #endif |
| 128 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityRendererCrashCount)); | 123 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityRendererCrashCount)); |
| 129 } | 124 } |
| OLD | NEW |