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

Side by Side Diff: dbus/signal_sender_verification_unittest.cc

Issue 12207058: Connect SparseHistogram with the rest of stats system (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 9 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 | « content/renderer/dom_automation_controller.cc ('k') | net/disk_cache/stats_histogram.h » ('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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/metrics/histogram_samples.h" 9 #include "base/metrics/histogram_samples.h"
10 #include "base/metrics/statistics_recorder.h" 10 #include "base/metrics/statistics_recorder.h"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 test_service_->SendTestSignal(kMessage); 175 test_service_->SendTestSignal(kMessage);
176 // Receive the signal with the object proxy. The signal is handled in 176 // Receive the signal with the object proxy. The signal is handled in
177 // SignalSenderVerificationTest::OnTestSignal() in the main thread. 177 // SignalSenderVerificationTest::OnTestSignal() in the main thread.
178 WaitForTestSignal(); 178 WaitForTestSignal();
179 ASSERT_EQ(kMessage, test_signal_string_); 179 ASSERT_EQ(kMessage, test_signal_string_);
180 } 180 }
181 181
182 TEST_F(SignalSenderVerificationTest, TestSignalRejected) { 182 TEST_F(SignalSenderVerificationTest, TestSignalRejected) {
183 // To make sure the histogram instance is created. 183 // To make sure the histogram instance is created.
184 UMA_HISTOGRAM_COUNTS("DBus.RejectedSignalCount", 0); 184 UMA_HISTOGRAM_COUNTS("DBus.RejectedSignalCount", 0);
185 base::Histogram* reject_signal_histogram = 185 base::HistogramBase* reject_signal_histogram =
186 base::StatisticsRecorder::FindHistogram("DBus.RejectedSignalCount"); 186 base::StatisticsRecorder::FindHistogram("DBus.RejectedSignalCount");
187 scoped_ptr<base::HistogramSamples> samples1( 187 scoped_ptr<base::HistogramSamples> samples1(
188 reject_signal_histogram->SnapshotSamples()); 188 reject_signal_histogram->SnapshotSamples());
189 189
190 const char kNewMessage[] = "hello, new world"; 190 const char kNewMessage[] = "hello, new world";
191 test_service2_->SendTestSignal(kNewMessage); 191 test_service2_->SendTestSignal(kNewMessage);
192 192
193 // This test tests that our callback is NOT called by the ObjectProxy. 193 // This test tests that our callback is NOT called by the ObjectProxy.
194 // Sleep to have message delivered to the client via the D-Bus service. 194 // Sleep to have message delivered to the client via the D-Bus service.
195 base::PlatformThread::Sleep(TestTimeouts::action_timeout()); 195 base::PlatformThread::Sleep(TestTimeouts::action_timeout());
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 // latest_name_owner_ becomes non empty as the new owner appears. 304 // latest_name_owner_ becomes non empty as the new owner appears.
305 ASSERT_FALSE(latest_name_owner_.empty()); 305 ASSERT_FALSE(latest_name_owner_.empty());
306 306
307 // Now the second service owns the name. 307 // Now the second service owns the name.
308 const char kNewMessage[] = "hello, new world"; 308 const char kNewMessage[] = "hello, new world";
309 309
310 test_service2_->SendTestSignal(kNewMessage); 310 test_service2_->SendTestSignal(kNewMessage);
311 WaitForTestSignal(); 311 WaitForTestSignal();
312 ASSERT_EQ(kNewMessage, test_signal_string_); 312 ASSERT_EQ(kNewMessage, test_signal_string_);
313 } 313 }
OLDNEW
« no previous file with comments | « content/renderer/dom_automation_controller.cc ('k') | net/disk_cache/stats_histogram.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698