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

Side by Side Diff: dbus/end_to_end_async_unittest.cc

Issue 11199007: Add sender verification of D-Bus signals. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: address comments. Created 8 years, 1 month 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
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 <algorithm> 5 #include <algorithm>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/stl_util.h" 12 #include "base/stl_util.h"
13 #include "base/test/test_timeouts.h" 13 #include "base/test/test_timeouts.h"
14 #include "base/threading/thread.h" 14 #include "base/threading/thread.h"
15 #include "base/threading/thread_restrictions.h" 15 #include "base/threading/thread_restrictions.h"
16 #include "dbus/bus.h" 16 #include "dbus/bus.h"
17 #include "dbus/message.h" 17 #include "dbus/message.h"
18 #include "dbus/object_path.h" 18 #include "dbus/object_path.h"
19 #include "dbus/object_proxy.h" 19 #include "dbus/object_proxy.h"
20 #include "dbus/test_service.h" 20 #include "dbus/test_service.h"
21 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
22 22
23 namespace { 23 namespace {
24 24
25 // See comments in ObjectProxy::RunResponseCallback() for why the number was 25 // See comments in ObjectProxy::RunResponseCallback() and
26 // chosen. 26 // ObjectProxy::UpdateNameOwnerAsyncfor why the number was chosen.
satorux1 2012/10/25 08:56:23 I think you don't need to update the comment.
Haruki Sato 2012/10/26 05:03:24 Done.
27 const int kHugePayloadSize = 64 << 20; // 64 MB 27 const int kHugePayloadSize = 64 << 20; // 64 MB
28 28
29 } // namespace 29 } // namespace
30 30
31 // The end-to-end test exercises the asynchronous APIs in ObjectProxy and 31 // The end-to-end test exercises the asynchronous APIs in ObjectProxy and
32 // ExportedObject. 32 // ExportedObject.
33 class EndToEndAsyncTest : public testing::Test { 33 class EndToEndAsyncTest : public testing::Test {
34 public: 34 public:
35 EndToEndAsyncTest() { 35 EndToEndAsyncTest() {
36 } 36 }
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 const char kMessage[] = "hello, world"; 620 const char kMessage[] = "hello, world";
621 // Send the test signal from the exported object. 621 // Send the test signal from the exported object.
622 test_service_->SendTestSignal(kMessage); 622 test_service_->SendTestSignal(kMessage);
623 // Receive the signal with the object proxy. 623 // Receive the signal with the object proxy.
624 WaitForTestSignal(); 624 WaitForTestSignal();
625 // Verify the string WAS NOT received by the original handler. 625 // Verify the string WAS NOT received by the original handler.
626 ASSERT_TRUE(test_signal_string_.empty()); 626 ASSERT_TRUE(test_signal_string_.empty());
627 // Verify the signal WAS received by the replacement handler. 627 // Verify the signal WAS received by the replacement handler.
628 ASSERT_EQ(kMessage, replacement_test_signal_string_); 628 ASSERT_EQ(kMessage, replacement_test_signal_string_);
629 } 629 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698