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 #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 Loading... |
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 Loading... |
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 } |
OLD | NEW |