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

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

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 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
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 <string> 5 #include <string>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/port.h" 9 #include "base/port.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 113
114 google_util::BrandForTesting brand_for_testing_; 114 google_util::BrandForTesting brand_for_testing_;
115 115
116 DISALLOW_COPY_AND_ASSIGN(TestMetricsLog); 116 DISALLOW_COPY_AND_ASSIGN(TestMetricsLog);
117 }; 117 };
118 118
119 } // namespace 119 } // namespace
120 120
121 class MetricsLogTest : public testing::Test { 121 class MetricsLogTest : public testing::Test {
122 public: 122 public:
123 MetricsLogTest() : message_loop_(MessageLoop::TYPE_IO) {} 123 MetricsLogTest() : message_loop_(base::MessageLoop::TYPE_IO) {}
124
124 protected: 125 protected:
125 void TestRecordEnvironment(bool proto_only) { 126 void TestRecordEnvironment(bool proto_only) {
126 TestMetricsLog log(kClientId, kSessionId); 127 TestMetricsLog log(kClientId, kSessionId);
127 128
128 std::vector<webkit::WebPluginInfo> plugins; 129 std::vector<webkit::WebPluginInfo> plugins;
129 GoogleUpdateMetrics google_update_metrics; 130 GoogleUpdateMetrics google_update_metrics;
130 if (proto_only) 131 if (proto_only)
131 log.RecordEnvironmentProto(plugins, google_update_metrics); 132 log.RecordEnvironmentProto(plugins, google_update_metrics);
132 else 133 else
133 log.RecordEnvironment(plugins, google_update_metrics, NULL); 134 log.RecordEnvironment(plugins, google_update_metrics, NULL);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 content::RunAllPendingInMessageLoop(); 172 content::RunAllPendingInMessageLoop();
172 173
173 #if defined(OS_CHROMEOS) 174 #if defined(OS_CHROMEOS)
174 chromeos::DBusThreadManager::Shutdown(); 175 chromeos::DBusThreadManager::Shutdown();
175 #endif // OS_CHROMEOS 176 #endif // OS_CHROMEOS
176 } 177 }
177 178
178 private: 179 private:
179 // This is necessary because eventually some tests call base::RepeatingTimer 180 // This is necessary because eventually some tests call base::RepeatingTimer
180 // functions and a message loop is required for that. 181 // functions and a message loop is required for that.
181 MessageLoop message_loop_; 182 base::MessageLoop message_loop_;
182 183
183 #if defined(OS_CHROMEOS) 184 #if defined(OS_CHROMEOS)
184 chromeos::MockDBusThreadManagerWithoutGMock* mock_dbus_thread_manager_; 185 chromeos::MockDBusThreadManagerWithoutGMock* mock_dbus_thread_manager_;
185 #endif // OS_CHROMEOS 186 #endif // OS_CHROMEOS
186 }; 187 };
187 188
188 TEST_F(MetricsLogTest, RecordEnvironment) { 189 TEST_F(MetricsLogTest, RecordEnvironment) {
189 // Test that recording the environment works via both of the public methods 190 // Test that recording the environment works via both of the public methods
190 // RecordEnvironment() and RecordEnvironmentProto(). 191 // RecordEnvironment() and RecordEnvironmentProto().
191 TestRecordEnvironment(false); 192 TestRecordEnvironment(false);
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 EXPECT_NE(std::string::npos, 355 EXPECT_NE(std::string::npos,
355 encoded.find(" childprocesscrashcount=\"10\"")); 356 encoded.find(" childprocesscrashcount=\"10\""));
356 EXPECT_EQ(std::string::npos, 357 EXPECT_EQ(std::string::npos,
357 encoded.find(" otherusercrashcount=")); 358 encoded.find(" otherusercrashcount="));
358 EXPECT_EQ(std::string::npos, 359 EXPECT_EQ(std::string::npos,
359 encoded.find(" kernelcrashcount=")); 360 encoded.find(" kernelcrashcount="));
360 EXPECT_EQ(std::string::npos, 361 EXPECT_EQ(std::string::npos,
361 encoded.find(" systemuncleanshutdowns=")); 362 encoded.find(" systemuncleanshutdowns="));
362 } 363 }
363 #endif // OS_CHROMEOS 364 #endif // OS_CHROMEOS
OLDNEW
« no previous file with comments | « chrome/browser/media_galleries/media_galleries_preferences_unittest.cc ('k') | chrome/browser/metrics/metrics_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698