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

Side by Side Diff: dbus/end_to_end_sync_unittest.cc

Issue 9378039: dbus: add ObjectPath type (Closed) Base URL: http://git.chromium.org/git/chromium/src@master
Patch Set: add patch for cryptohome_client Created 8 years, 10 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
« no previous file with comments | « dbus/end_to_end_async_unittest.cc ('k') | dbus/exported_object.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) 2011 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/memory/ref_counted.h" 5 #include "base/memory/ref_counted.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "dbus/bus.h" 7 #include "dbus/bus.h"
8 #include "dbus/message.h" 8 #include "dbus/message.h"
9 #include "dbus/object_path.h"
9 #include "dbus/object_proxy.h" 10 #include "dbus/object_proxy.h"
10 #include "dbus/test_service.h" 11 #include "dbus/test_service.h"
11 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
12 13
13 // The end-to-end test exercises the synchronous APIs in ObjectProxy and 14 // The end-to-end test exercises the synchronous APIs in ObjectProxy and
14 // ExportedObject. The test will launch a thread for the service side 15 // ExportedObject. The test will launch a thread for the service side
15 // operations (i.e. ExportedObject side). 16 // operations (i.e. ExportedObject side).
16 class EndToEndSyncTest : public testing::Test { 17 class EndToEndSyncTest : public testing::Test {
17 public: 18 public:
18 EndToEndSyncTest() { 19 EndToEndSyncTest() {
19 } 20 }
20 21
21 virtual void SetUp() { 22 virtual void SetUp() {
22 // Start the test service; 23 // Start the test service;
23 dbus::TestService::Options options; 24 dbus::TestService::Options options;
24 test_service_.reset(new dbus::TestService(options)); 25 test_service_.reset(new dbus::TestService(options));
25 ASSERT_TRUE(test_service_->StartService()); 26 ASSERT_TRUE(test_service_->StartService());
26 ASSERT_TRUE(test_service_->WaitUntilServiceIsStarted()); 27 ASSERT_TRUE(test_service_->WaitUntilServiceIsStarted());
27 ASSERT_FALSE(test_service_->HasDBusThread()); 28 ASSERT_FALSE(test_service_->HasDBusThread());
28 29
29 // Create the client. 30 // Create the client.
30 dbus::Bus::Options client_bus_options; 31 dbus::Bus::Options client_bus_options;
31 client_bus_options.bus_type = dbus::Bus::SESSION; 32 client_bus_options.bus_type = dbus::Bus::SESSION;
32 client_bus_options.connection_type = dbus::Bus::PRIVATE; 33 client_bus_options.connection_type = dbus::Bus::PRIVATE;
33 client_bus_ = new dbus::Bus(client_bus_options); 34 client_bus_ = new dbus::Bus(client_bus_options);
34 object_proxy_ = client_bus_->GetObjectProxy("org.chromium.TestService", 35 object_proxy_ = client_bus_->GetObjectProxy(
35 "/org/chromium/TestObject"); 36 "org.chromium.TestService",
37 dbus::ObjectPath("/org/chromium/TestObject"));
36 ASSERT_FALSE(client_bus_->HasDBusThread()); 38 ASSERT_FALSE(client_bus_->HasDBusThread());
37 } 39 }
38 40
39 virtual void TearDown() { 41 virtual void TearDown() {
40 test_service_->ShutdownAndBlock(); 42 test_service_->ShutdownAndBlock();
41 test_service_->Stop(); 43 test_service_->Stop();
42 client_bus_->ShutdownAndBlock(); 44 client_bus_->ShutdownAndBlock();
43 } 45 }
44 46
45 protected: 47 protected:
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 } 97 }
96 98
97 TEST_F(EndToEndSyncTest, BrokenMethod) { 99 TEST_F(EndToEndSyncTest, BrokenMethod) {
98 dbus::MethodCall method_call("org.chromium.TestInterface", "BrokenMethod"); 100 dbus::MethodCall method_call("org.chromium.TestInterface", "BrokenMethod");
99 101
100 const int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT; 102 const int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT;
101 scoped_ptr<dbus::Response> response( 103 scoped_ptr<dbus::Response> response(
102 object_proxy_->CallMethodAndBlock(&method_call, timeout_ms)); 104 object_proxy_->CallMethodAndBlock(&method_call, timeout_ms));
103 ASSERT_FALSE(response.get()); 105 ASSERT_FALSE(response.get());
104 } 106 }
OLDNEW
« no previous file with comments | « dbus/end_to_end_async_unittest.cc ('k') | dbus/exported_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698