Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(503)

Side by Side Diff: chrome/browser/metrics/metrics_log_unittest.cc

Issue 310493002: metrics: call LoginState::Shutdown() at end of unit tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add virtual keyword to destructor Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/metrics/metrics_service_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/browser/metrics/metrics_log.h" 5 #include "chrome/browser/metrics/metrics_log.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 MetricsService::RegisterPrefs(prefs_.registry()); 116 MetricsService::RegisterPrefs(prefs_.registry());
117 #if defined(OS_CHROMEOS) 117 #if defined(OS_CHROMEOS)
118 // TODO(blundell): Remove this code once MetricsService no longer creates 118 // TODO(blundell): Remove this code once MetricsService no longer creates
119 // ChromeOSMetricsProvider. Also remove the #include of login_state.h 119 // ChromeOSMetricsProvider. Also remove the #include of login_state.h
120 // (http://crbug.com/375776) 120 // (http://crbug.com/375776)
121 if (!chromeos::LoginState::IsInitialized()) 121 if (!chromeos::LoginState::IsInitialized())
122 chromeos::LoginState::Initialize(); 122 chromeos::LoginState::Initialize();
123 #endif // defined(OS_CHROMEOS) 123 #endif // defined(OS_CHROMEOS)
124 } 124 }
125 125
126 virtual ~MetricsLogTest() {
127 #if defined(OS_CHROMEOS)
128 // TODO(blundell): Remove this code once MetricsService no longer creates
129 // ChromeOSMetricsProvider.
130 chromeos::LoginState::Shutdown();
131 #endif // defined(OS_CHROMEOS)
132 }
133
126 protected: 134 protected:
127 // Check that the values in |system_values| correspond to the test data 135 // Check that the values in |system_values| correspond to the test data
128 // defined at the top of this file. 136 // defined at the top of this file.
129 void CheckSystemProfile(const metrics::SystemProfileProto& system_profile) { 137 void CheckSystemProfile(const metrics::SystemProfileProto& system_profile) {
130 EXPECT_EQ(kInstallDateExpected, system_profile.install_date()); 138 EXPECT_EQ(kInstallDateExpected, system_profile.install_date());
131 EXPECT_EQ(kEnabledDateExpected, system_profile.uma_enabled_date()); 139 EXPECT_EQ(kEnabledDateExpected, system_profile.uma_enabled_date());
132 140
133 ASSERT_EQ(arraysize(kFieldTrialIds) + arraysize(kSyntheticTrials), 141 ASSERT_EQ(arraysize(kFieldTrialIds) + arraysize(kSyntheticTrials),
134 static_cast<size_t>(system_profile.field_trial_size())); 142 static_cast<size_t>(system_profile.field_trial_size()));
135 for (size_t i = 0; i < arraysize(kFieldTrialIds); ++i) { 143 for (size_t i = 0; i < arraysize(kFieldTrialIds); ++i) {
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 tracked_object->process_type()); 476 tracked_object->process_type());
469 } 477 }
470 } 478 }
471 479
472 TEST_F(MetricsLogTest, ChromeChannelWrittenToProtobuf) { 480 TEST_F(MetricsLogTest, ChromeChannelWrittenToProtobuf) {
473 metrics::TestMetricsServiceClient client; 481 metrics::TestMetricsServiceClient client;
474 TestMetricsLog log( 482 TestMetricsLog log(
475 "user@test.com", kSessionId, MetricsLog::ONGOING_LOG, &client, &prefs_); 483 "user@test.com", kSessionId, MetricsLog::ONGOING_LOG, &client, &prefs_);
476 EXPECT_TRUE(log.uma_proto().system_profile().has_channel()); 484 EXPECT_TRUE(log.uma_proto().system_profile().has_channel());
477 } 485 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/metrics/metrics_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698