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

Side by Side Diff: chromeos/dbus/ibus/ibus_panel_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_panel_service.h" 5 #include "chromeos/dbus/ibus/ibus_panel_service.h"
6 6
7 #include <map> 7 #include <map>
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 // Create a mock exported object. 216 // Create a mock exported object.
217 mock_exported_object_ = new dbus::MockExportedObject( 217 mock_exported_object_ = new dbus::MockExportedObject(
218 mock_bus_.get(), 218 mock_bus_.get(),
219 dbus::ObjectPath(ibus::panel::kServicePath)); 219 dbus::ObjectPath(ibus::panel::kServicePath));
220 220
221 EXPECT_CALL(*mock_bus_.get(), 221 EXPECT_CALL(*mock_bus_.get(),
222 GetExportedObject(dbus::ObjectPath( 222 GetExportedObject(dbus::ObjectPath(
223 ibus::panel::kServicePath))) 223 ibus::panel::kServicePath)))
224 .WillOnce(Return(mock_exported_object_.get())); 224 .WillOnce(Return(mock_exported_object_.get()));
225 225
226 EXPECT_CALL(*mock_exported_object_, ExportMethod( 226 EXPECT_CALL(*mock_exported_object_.get(),
227 ibus::panel::kServiceInterface, 227 ExportMethod(ibus::panel::kServiceInterface,
228 ibus::panel::kUpdateLookupTableMethod, _, _)) 228 ibus::panel::kUpdateLookupTableMethod,
229 .WillRepeatedly( 229 _,
230 Invoke(this, &IBusPanelServiceTest::OnMethodExported)); 230 _))
231 .WillRepeatedly(Invoke(this, &IBusPanelServiceTest::OnMethodExported));
231 232
232 EXPECT_CALL(*mock_exported_object_, ExportMethod( 233 EXPECT_CALL(*mock_exported_object_.get(),
233 ibus::panel::kServiceInterface, 234 ExportMethod(ibus::panel::kServiceInterface,
234 ibus::panel::kHideLookupTableMethod, _, _)) 235 ibus::panel::kHideLookupTableMethod,
235 .WillRepeatedly( 236 _,
236 Invoke(this, &IBusPanelServiceTest::OnMethodExported)); 237 _))
238 .WillRepeatedly(Invoke(this, &IBusPanelServiceTest::OnMethodExported));
237 239
238 EXPECT_CALL(*mock_exported_object_, ExportMethod( 240 EXPECT_CALL(*mock_exported_object_.get(),
239 ibus::panel::kServiceInterface, 241 ExportMethod(ibus::panel::kServiceInterface,
240 ibus::panel::kUpdateAuxiliaryTextMethod, _, _)) 242 ibus::panel::kUpdateAuxiliaryTextMethod,
241 .WillRepeatedly( 243 _,
242 Invoke(this, &IBusPanelServiceTest::OnMethodExported)); 244 _))
245 .WillRepeatedly(Invoke(this, &IBusPanelServiceTest::OnMethodExported));
243 246
244 EXPECT_CALL(*mock_exported_object_, ExportMethod( 247 EXPECT_CALL(*mock_exported_object_.get(),
245 ibus::panel::kServiceInterface, 248 ExportMethod(ibus::panel::kServiceInterface,
246 ibus::panel::kHideAuxiliaryTextMethod, _, _)) 249 ibus::panel::kHideAuxiliaryTextMethod,
247 .WillRepeatedly( 250 _,
248 Invoke(this, &IBusPanelServiceTest::OnMethodExported)); 251 _))
252 .WillRepeatedly(Invoke(this, &IBusPanelServiceTest::OnMethodExported));
249 253
250 EXPECT_CALL(*mock_exported_object_, ExportMethod( 254 EXPECT_CALL(*mock_exported_object_.get(),
251 ibus::panel::kServiceInterface, 255 ExportMethod(ibus::panel::kServiceInterface,
252 ibus::panel::kUpdatePreeditTextMethod, _, _)) 256 ibus::panel::kUpdatePreeditTextMethod,
253 .WillRepeatedly( 257 _,
254 Invoke(this, &IBusPanelServiceTest::OnMethodExported)); 258 _))
259 .WillRepeatedly(Invoke(this, &IBusPanelServiceTest::OnMethodExported));
255 260
256 EXPECT_CALL(*mock_exported_object_, ExportMethod( 261 EXPECT_CALL(*mock_exported_object_.get(),
257 ibus::panel::kServiceInterface, 262 ExportMethod(ibus::panel::kServiceInterface,
258 ibus::panel::kHidePreeditTextMethod, _, _)) 263 ibus::panel::kHidePreeditTextMethod,
259 .WillRepeatedly( 264 _,
260 Invoke(this, &IBusPanelServiceTest::OnMethodExported)); 265 _))
266 .WillRepeatedly(Invoke(this, &IBusPanelServiceTest::OnMethodExported));
261 267
262 EXPECT_CALL(*mock_exported_object_, ExportMethod( 268 EXPECT_CALL(*mock_exported_object_.get(),
263 ibus::panel::kServiceInterface, 269 ExportMethod(ibus::panel::kServiceInterface,
264 ibus::panel::kRegisterPropertiesMethod, _, _)) 270 ibus::panel::kRegisterPropertiesMethod,
265 .WillRepeatedly( 271 _,
266 Invoke(this, &IBusPanelServiceTest::OnMethodExported)); 272 _))
273 .WillRepeatedly(Invoke(this, &IBusPanelServiceTest::OnMethodExported));
267 274
268 EXPECT_CALL(*mock_exported_object_, ExportMethod( 275 EXPECT_CALL(*mock_exported_object_.get(),
269 ibus::panel::kServiceInterface, 276 ExportMethod(ibus::panel::kServiceInterface,
270 ibus::panel::kUpdatePropertyMethod, _, _)) 277 ibus::panel::kUpdatePropertyMethod,
271 .WillRepeatedly( 278 _,
272 Invoke(this, &IBusPanelServiceTest::OnMethodExported)); 279 _))
280 .WillRepeatedly(Invoke(this, &IBusPanelServiceTest::OnMethodExported));
273 281
274 EXPECT_CALL(*mock_exported_object_, ExportMethod( 282 EXPECT_CALL(
275 ibus::panel::kServiceInterface, 283 *mock_exported_object_.get(),
276 ibus::panel::kFocusInMethod, _, _)) 284 ExportMethod(
277 .WillRepeatedly( 285 ibus::panel::kServiceInterface, ibus::panel::kFocusInMethod, _, _))
278 Invoke(this, &IBusPanelServiceTest::OnMethodExported)); 286 .WillRepeatedly(Invoke(this, &IBusPanelServiceTest::OnMethodExported));
279 287
280 EXPECT_CALL(*mock_exported_object_, ExportMethod( 288 EXPECT_CALL(
281 ibus::panel::kServiceInterface, 289 *mock_exported_object_.get(),
282 ibus::panel::kFocusOutMethod, _, _)) 290 ExportMethod(
283 .WillRepeatedly( 291 ibus::panel::kServiceInterface, ibus::panel::kFocusOutMethod, _, _))
284 Invoke(this, &IBusPanelServiceTest::OnMethodExported)); 292 .WillRepeatedly(Invoke(this, &IBusPanelServiceTest::OnMethodExported));
285 293
286 EXPECT_CALL(*mock_exported_object_, ExportMethod( 294 EXPECT_CALL(*mock_exported_object_.get(),
287 ibus::panel::kServiceInterface, 295 ExportMethod(ibus::panel::kServiceInterface,
288 ibus::panel::kStateChangedMethod, _, _)) 296 ibus::panel::kStateChangedMethod,
289 .WillRepeatedly( 297 _,
290 Invoke(this, &IBusPanelServiceTest::OnMethodExported)); 298 _))
299 .WillRepeatedly(Invoke(this, &IBusPanelServiceTest::OnMethodExported));
291 300
292 // Suppress uninteresting mock function call warning. 301 // Suppress uninteresting mock function call warning.
293 EXPECT_CALL(*mock_bus_.get(), 302 EXPECT_CALL(*mock_bus_.get(),
294 AssertOnOriginThread()) 303 AssertOnOriginThread())
295 .WillRepeatedly(Return()); 304 .WillRepeatedly(Return());
296 305
297 stub_input_context_client_.reset(IBusInputContextClient::Create( 306 stub_input_context_client_.reset(IBusInputContextClient::Create(
298 STUB_DBUS_CLIENT_IMPLEMENTATION)); 307 STUB_DBUS_CLIENT_IMPLEMENTATION));
299 308
300 // Create a service 309 // Create a service
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 method_callback_map_.end()); 522 method_callback_map_.end());
514 method_callback_map_[ibus::panel::kUpdatePreeditTextMethod].Run( 523 method_callback_map_[ibus::panel::kUpdatePreeditTextMethod].Run(
515 &method_call, 524 &method_call,
516 base::Bind(&MockResponseSender::Run, 525 base::Bind(&MockResponseSender::Run,
517 base::Unretained(&response_sender))); 526 base::Unretained(&response_sender)));
518 } 527 }
519 528
520 TEST_F(IBusPanelServiceTest, CursorUpTest) { 529 TEST_F(IBusPanelServiceTest, CursorUpTest) {
521 // Set expectations. 530 // Set expectations.
522 NullArgumentVerifier evaluator(ibus::panel::kCursorUpSignal); 531 NullArgumentVerifier evaluator(ibus::panel::kCursorUpSignal);
523 EXPECT_CALL(*mock_exported_object_, SendSignal(_)) 532 EXPECT_CALL(*mock_exported_object_.get(), SendSignal(_))
524 .WillOnce(Invoke(&evaluator, &NullArgumentVerifier::Verify)); 533 .WillOnce(Invoke(&evaluator, &NullArgumentVerifier::Verify));
525 534
526 // Emit signal. 535 // Emit signal.
527 service_->CursorUp(); 536 service_->CursorUp();
528 } 537 }
529 538
530 TEST_F(IBusPanelServiceTest, CursorDownTest) { 539 TEST_F(IBusPanelServiceTest, CursorDownTest) {
531 // Set expectations. 540 // Set expectations.
532 NullArgumentVerifier evaluator(ibus::panel::kCursorDownSignal); 541 NullArgumentVerifier evaluator(ibus::panel::kCursorDownSignal);
533 EXPECT_CALL(*mock_exported_object_, SendSignal(_)) 542 EXPECT_CALL(*mock_exported_object_.get(), SendSignal(_))
534 .WillOnce(Invoke(&evaluator, &NullArgumentVerifier::Verify)); 543 .WillOnce(Invoke(&evaluator, &NullArgumentVerifier::Verify));
535 544
536 // Emit signal. 545 // Emit signal.
537 service_->CursorDown(); 546 service_->CursorDown();
538 } 547 }
539 548
540 TEST_F(IBusPanelServiceTest, PageUpTest) { 549 TEST_F(IBusPanelServiceTest, PageUpTest) {
541 // Set expectations. 550 // Set expectations.
542 NullArgumentVerifier evaluator(ibus::panel::kPageUpSignal); 551 NullArgumentVerifier evaluator(ibus::panel::kPageUpSignal);
543 EXPECT_CALL(*mock_exported_object_, SendSignal(_)) 552 EXPECT_CALL(*mock_exported_object_.get(), SendSignal(_))
544 .WillOnce(Invoke(&evaluator, &NullArgumentVerifier::Verify)); 553 .WillOnce(Invoke(&evaluator, &NullArgumentVerifier::Verify));
545 554
546 // Emit signal. 555 // Emit signal.
547 service_->PageUp(); 556 service_->PageUp();
548 } 557 }
549 558
550 TEST_F(IBusPanelServiceTest, PageDownTest) { 559 TEST_F(IBusPanelServiceTest, PageDownTest) {
551 // Set expectations. 560 // Set expectations.
552 NullArgumentVerifier evaluator(ibus::panel::kPageDownSignal); 561 NullArgumentVerifier evaluator(ibus::panel::kPageDownSignal);
553 EXPECT_CALL(*mock_exported_object_, SendSignal(_)) 562 EXPECT_CALL(*mock_exported_object_.get(), SendSignal(_))
554 .WillOnce(Invoke(&evaluator, &NullArgumentVerifier::Verify)); 563 .WillOnce(Invoke(&evaluator, &NullArgumentVerifier::Verify));
555 564
556 // Emit signal. 565 // Emit signal.
557 service_->PageDown(); 566 service_->PageDown();
558 } 567 }
559 568
560 TEST_F(IBusPanelServiceTest, RegisterPropertiesTest) { 569 TEST_F(IBusPanelServiceTest, RegisterPropertiesTest) {
561 // Set expectations. 570 // Set expectations.
562 std::vector<std::string> keys; 571 std::vector<std::string> keys;
563 keys.push_back("key1"); 572 keys.push_back("key1");
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 // Call exported function. 625 // Call exported function.
617 EXPECT_NE(method_callback_map_.find(ibus::panel::kUpdatePropertyMethod), 626 EXPECT_NE(method_callback_map_.find(ibus::panel::kUpdatePropertyMethod),
618 method_callback_map_.end()); 627 method_callback_map_.end());
619 method_callback_map_[ibus::panel::kUpdatePropertyMethod].Run( 628 method_callback_map_[ibus::panel::kUpdatePropertyMethod].Run(
620 &method_call, 629 &method_call,
621 base::Bind(&MockResponseSender::Run, 630 base::Bind(&MockResponseSender::Run,
622 base::Unretained(&response_sender))); 631 base::Unretained(&response_sender)));
623 } 632 }
624 633
625 } // namespace chromeos 634 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/ibus/ibus_input_context_client_unittest.cc ('k') | chromeos/dbus/modem_messaging_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698