OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 EXPECT_EQ(4, prefs->GetInteger(prefs::kStabilityPageLoadCount)); | 67 EXPECT_EQ(4, prefs->GetInteger(prefs::kStabilityPageLoadCount)); |
68 #else | 68 #else |
69 EXPECT_EQ(3, prefs->GetInteger(prefs::kStabilityPageLoadCount)); | 69 EXPECT_EQ(3, prefs->GetInteger(prefs::kStabilityPageLoadCount)); |
70 #endif | 70 #endif |
71 EXPECT_EQ(0, prefs->GetInteger(prefs::kStabilityRendererCrashCount)); | 71 EXPECT_EQ(0, prefs->GetInteger(prefs::kStabilityRendererCrashCount)); |
72 // TODO(isherman): We should also verify that prefs::kStabilityExitedCleanly | 72 // TODO(isherman): We should also verify that prefs::kStabilityExitedCleanly |
73 // is set to true, but this preference isn't set until the browser | 73 // is set to true, but this preference isn't set until the browser |
74 // exits... it's not clear to me how to test that. | 74 // exits... it's not clear to me how to test that. |
75 } | 75 } |
76 | 76 |
77 // Flaky: http://crbug.com/18738 | 77 IN_PROC_BROWSER_TEST_F(MetricsServiceTest, CrashRenderers) { |
78 IN_PROC_BROWSER_TEST_F(MetricsServiceTest, FLAKY_CrashRenderers) { | |
79 OpenTabs(); | 78 OpenTabs(); |
80 | 79 |
81 // Kill the process for one of the tabs. | 80 // Kill the process for one of the tabs. |
82 ui_test_utils::WindowedNotificationObserver observer( | 81 ui_test_utils::WindowedNotificationObserver observer( |
83 content::NOTIFICATION_RENDERER_PROCESS_CLOSED, | 82 content::NOTIFICATION_RENDERER_PROCESS_CLOSED, |
84 content::NotificationService::AllSources()); | 83 content::NotificationService::AllSources()); |
85 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUICrashURL)); | 84 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUICrashURL)); |
86 observer.Wait(); | 85 observer.Wait(); |
86 // The MetricsService listens for the same notification, so process any | |
87 // pending tasks in the message loop to avoid race conditions. | |
88 ui_test_utils::RunAllPendingInMessageLoop(); | |
jar (doing other things)
2012/04/07 02:46:48
This pattern always scares me... as it is most com
Ilya Sherman
2012/04/10 01:00:25
I think you're absolutely right. Added the loop.
jar (doing other things)
2012/04/10 01:32:22
The reason I was after outputting something is tha
Ilya Sherman
2012/04/10 01:33:53
Yes, the test logs definitely clearly indicate whi
| |
87 | 89 |
88 // Verify that the expected stability metrics were recorded. | 90 // Verify that the expected stability metrics were recorded. |
89 const PrefService* prefs = g_browser_process->local_state(); | 91 const PrefService* prefs = g_browser_process->local_state(); |
90 EXPECT_EQ(1, prefs->GetInteger(prefs::kStabilityLaunchCount)); | 92 EXPECT_EQ(1, prefs->GetInteger(prefs::kStabilityLaunchCount)); |
91 #if defined(USE_VIRTUAL_KEYBOARD) | 93 #if defined(USE_VIRTUAL_KEYBOARD) |
92 // The keyboard page loads. | 94 // The keyboard page loads. |
93 EXPECT_EQ(5, prefs->GetInteger(prefs::kStabilityPageLoadCount)); | 95 EXPECT_EQ(5, prefs->GetInteger(prefs::kStabilityPageLoadCount)); |
94 #else | 96 #else |
95 EXPECT_EQ(4, prefs->GetInteger(prefs::kStabilityPageLoadCount)); | 97 EXPECT_EQ(4, prefs->GetInteger(prefs::kStabilityPageLoadCount)); |
96 #endif | 98 #endif |
97 EXPECT_EQ(1, prefs->GetInteger(prefs::kStabilityRendererCrashCount)); | 99 EXPECT_EQ(1, prefs->GetInteger(prefs::kStabilityRendererCrashCount)); |
98 // TODO(isherman): We should also verify that prefs::kStabilityExitedCleanly | 100 // TODO(isherman): We should also verify that prefs::kStabilityExitedCleanly |
99 // is set to true, but this preference isn't set until the browser | 101 // is set to true, but this preference isn't set until the browser |
100 // exits... it's not clear to me how to test that. | 102 // exits... it's not clear to me how to test that. |
101 } | 103 } |
OLD | NEW |