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 <memory> | 5 #include <memory> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
10 #include "base/metrics/histogram_samples.h" | 10 #include "base/metrics/histogram_samples.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 TEST_F(SignalSenderVerificationTest, TestSignalAccepted) { | 190 TEST_F(SignalSenderVerificationTest, TestSignalAccepted) { |
191 const char kMessage[] = "hello, world"; | 191 const char kMessage[] = "hello, world"; |
192 // Send the test signal from the exported object. | 192 // Send the test signal from the exported object. |
193 test_service_->SendTestSignal(kMessage); | 193 test_service_->SendTestSignal(kMessage); |
194 // Receive the signal with the object proxy. The signal is handled in | 194 // Receive the signal with the object proxy. The signal is handled in |
195 // SignalSenderVerificationTest::OnTestSignal() in the main thread. | 195 // SignalSenderVerificationTest::OnTestSignal() in the main thread. |
196 WaitForTestSignal(); | 196 WaitForTestSignal(); |
197 ASSERT_EQ(kMessage, test_signal_string_); | 197 ASSERT_EQ(kMessage, test_signal_string_); |
198 } | 198 } |
199 | 199 |
200 // Disabled, http://crbug.com/407063 . | 200 TEST_F(SignalSenderVerificationTest, TestSignalRejected) { |
201 TEST_F(SignalSenderVerificationTest, DISABLED_TestSignalRejected) { | |
202 // To make sure the histogram instance is created. | |
203 UMA_HISTOGRAM_COUNTS("DBus.RejectedSignalCount", 0); | |
204 base::HistogramBase* reject_signal_histogram = | |
205 base::StatisticsRecorder::FindHistogram("DBus.RejectedSignalCount"); | |
206 std::unique_ptr<base::HistogramSamples> samples1( | |
207 reject_signal_histogram->SnapshotSamples()); | |
208 | |
209 const char kNewMessage[] = "hello, new world"; | 201 const char kNewMessage[] = "hello, new world"; |
210 test_service2_->SendTestSignal(kNewMessage); | 202 test_service2_->SendTestSignal(kNewMessage); |
211 | 203 |
212 // This test tests that our callback is NOT called by the ObjectProxy. | 204 // This test tests that our callback is NOT called by the ObjectProxy. |
213 // Sleep to have message delivered to the client via the D-Bus service. | 205 // Sleep to have message delivered to the client via the D-Bus service. |
214 base::PlatformThread::Sleep(TestTimeouts::action_timeout()); | 206 base::PlatformThread::Sleep(TestTimeouts::tiny_timeout()); |
215 | |
216 std::unique_ptr<base::HistogramSamples> samples2( | |
217 reject_signal_histogram->SnapshotSamples()); | |
218 | 207 |
219 ASSERT_EQ("", test_signal_string_); | 208 ASSERT_EQ("", test_signal_string_); |
220 EXPECT_EQ(samples1->TotalCount() + 1, samples2->TotalCount()); | |
221 } | 209 } |
222 | 210 |
223 TEST_F(SignalSenderVerificationTest, TestOwnerChanged) { | 211 TEST_F(SignalSenderVerificationTest, TestOwnerChanged) { |
224 const char kMessage[] = "hello, world"; | 212 const char kMessage[] = "hello, world"; |
225 | 213 |
226 // Send the test signal from the exported object. | 214 // Send the test signal from the exported object. |
227 test_service_->SendTestSignal(kMessage); | 215 test_service_->SendTestSignal(kMessage); |
228 // Receive the signal with the object proxy. The signal is handled in | 216 // Receive the signal with the object proxy. The signal is handled in |
229 // SignalSenderVerificationTest::OnTestSignal() in the main thread. | 217 // SignalSenderVerificationTest::OnTestSignal() in the main thread. |
230 WaitForTestSignal(); | 218 WaitForTestSignal(); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 | 386 |
399 // Now the second service owns the name. | 387 // Now the second service owns the name. |
400 const char kNewMessage[] = "hello, new world"; | 388 const char kNewMessage[] = "hello, new world"; |
401 | 389 |
402 test_service2_->SendTestSignal(kNewMessage); | 390 test_service2_->SendTestSignal(kNewMessage); |
403 WaitForTestSignal(); | 391 WaitForTestSignal(); |
404 ASSERT_EQ(kNewMessage, test_signal_string_); | 392 ASSERT_EQ(kNewMessage, test_signal_string_); |
405 } | 393 } |
406 | 394 |
407 } // namespace dbus | 395 } // namespace dbus |
OLD | NEW |