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

Side by Side Diff: chromeos/dbus/ibus/ibus_engine_factory_service_unittest.cc

Issue 16998003: Update CrOS to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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
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 "chromeos/dbus/ibus/ibus_engine_factory_service.h" 5 #include "chromeos/dbus/ibus/ibus_engine_factory_service.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "chromeos/dbus/ibus/ibus_constants.h" 10 #include "chromeos/dbus/ibus/ibus_constants.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // Create a mock bus. 87 // Create a mock bus.
88 dbus::Bus::Options options; 88 dbus::Bus::Options options;
89 options.bus_type = dbus::Bus::SYSTEM; 89 options.bus_type = dbus::Bus::SYSTEM;
90 mock_bus_ = new dbus::MockBus(options); 90 mock_bus_ = new dbus::MockBus(options);
91 91
92 // Create a mock exported object. 92 // Create a mock exported object.
93 mock_exported_object_ = new dbus::MockExportedObject( 93 mock_exported_object_ = new dbus::MockExportedObject(
94 mock_bus_.get(), 94 mock_bus_.get(),
95 dbus::ObjectPath(ibus::engine_factory::kServicePath)); 95 dbus::ObjectPath(ibus::engine_factory::kServicePath));
96 96
97 EXPECT_CALL(*mock_bus_, 97 EXPECT_CALL(
98 GetExportedObject(dbus::ObjectPath( 98 *mock_bus_.get(),
99 ibus::engine_factory::kServicePath))) 99 GetExportedObject(dbus::ObjectPath(ibus::engine_factory::kServicePath)))
100 .WillOnce(Return(mock_exported_object_.get())); 100 .WillOnce(Return(mock_exported_object_.get()));
101 101
102 EXPECT_CALL(*mock_bus_, AssertOnOriginThread()) 102 EXPECT_CALL(*mock_bus_.get(), AssertOnOriginThread())
103 .WillRepeatedly(Return()); 103 .WillRepeatedly(Return());
104 104
105 EXPECT_CALL(*mock_exported_object_, ExportMethod( 105 EXPECT_CALL(*mock_exported_object_.get(),
106 ibus::engine_factory::kServiceInterface, 106 ExportMethod(ibus::engine_factory::kServiceInterface,
107 ibus::engine_factory::kCreateEngineMethod, 107 ibus::engine_factory::kCreateEngineMethod,
108 _, 108 _,
109 _)) 109 _))
110 .WillRepeatedly( 110 .WillRepeatedly(
111 Invoke(this, &IBusEngineFactoryServiceTest::OnMethodExported)); 111 Invoke(this, &IBusEngineFactoryServiceTest::OnMethodExported));
112 112
113 service_.reset(IBusEngineFactoryService::Create( 113 service_.reset(IBusEngineFactoryService::Create(
114 mock_bus_, 114 mock_bus_.get(), REAL_DBUS_CLIENT_IMPLEMENTATION));
115 REAL_DBUS_CLIENT_IMPLEMENTATION));
116 } 115 }
117 116
118 protected: 117 protected:
119 // The service to be tested. 118 // The service to be tested.
120 scoped_ptr<IBusEngineFactoryService> service_; 119 scoped_ptr<IBusEngineFactoryService> service_;
121 // The mock bus. 120 // The mock bus.
122 scoped_refptr<dbus::MockBus> mock_bus_; 121 scoped_refptr<dbus::MockBus> mock_bus_;
123 // The mock exported object. 122 // The mock exported object.
124 scoped_refptr<dbus::MockExportedObject> mock_exported_object_; 123 scoped_refptr<dbus::MockExportedObject> mock_exported_object_;
125 // The map from method name to method call handler. 124 // The map from method name to method call handler.
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 // Unset the handler so expect not calling handler. 223 // Unset the handler so expect not calling handler.
225 service_->UnsetCreateEngineHandler(kSampleEngine); 224 service_->UnsetCreateEngineHandler(kSampleEngine);
226 method_exported_map_[ibus::engine_factory::kCreateEngineMethod].Run( 225 method_exported_map_[ibus::engine_factory::kCreateEngineMethod].Run(
227 &method_call, 226 &method_call,
228 base::Bind(&MockCreateEngineResponseSender::CheckCreateEngineResponse, 227 base::Bind(&MockCreateEngineResponseSender::CheckCreateEngineResponse,
229 base::Unretained(&response_sender))); 228 base::Unretained(&response_sender)));
230 message_loop_.RunUntilIdle(); 229 message_loop_.RunUntilIdle();
231 } 230 }
232 231
233 } // namespace chromeos 232 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/ibus/ibus_config_client_unittest.cc ('k') | chromeos/dbus/ibus/ibus_engine_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698