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 "dbus/test_service.h" | 5 #include "dbus/test_service.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
7 #include <string> | 9 #include <string> |
8 #include <vector> | 10 #include <vector> |
9 | 11 |
10 #include "base/bind.h" | 12 #include "base/bind.h" |
11 #include "base/test/test_timeouts.h" | 13 #include "base/test/test_timeouts.h" |
12 #include "base/threading/platform_thread.h" | 14 #include "base/threading/platform_thread.h" |
13 #include "dbus/bus.h" | 15 #include "dbus/bus.h" |
14 #include "dbus/exported_object.h" | 16 #include "dbus/exported_object.h" |
15 #include "dbus/message.h" | 17 #include "dbus/message.h" |
16 #include "dbus/object_manager.h" | 18 #include "dbus/object_manager.h" |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 response_sender.Run(response.Pass()); | 423 response_sender.Run(response.Pass()); |
422 } else if (name == "Bytes") { | 424 } else if (name == "Bytes") { |
423 // Return the previous value for the "Bytes" property: | 425 // Return the previous value for the "Bytes" property: |
424 // Variant<[0x54, 0x65, 0x73, 0x74]> | 426 // Variant<[0x54, 0x65, 0x73, 0x74]> |
425 scoped_ptr<Response> response = Response::FromMethodCall(method_call); | 427 scoped_ptr<Response> response = Response::FromMethodCall(method_call); |
426 MessageWriter writer(response.get()); | 428 MessageWriter writer(response.get()); |
427 MessageWriter variant_writer(NULL); | 429 MessageWriter variant_writer(NULL); |
428 MessageWriter variant_array_writer(NULL); | 430 MessageWriter variant_array_writer(NULL); |
429 | 431 |
430 writer.OpenVariant("ay", &variant_writer); | 432 writer.OpenVariant("ay", &variant_writer); |
431 const uint8 bytes[] = { 0x54, 0x65, 0x73, 0x74 }; | 433 const uint8_t bytes[] = {0x54, 0x65, 0x73, 0x74}; |
432 variant_writer.AppendArrayOfBytes(bytes, sizeof(bytes)); | 434 variant_writer.AppendArrayOfBytes(bytes, sizeof(bytes)); |
433 writer.CloseContainer(&variant_writer); | 435 writer.CloseContainer(&variant_writer); |
434 | 436 |
435 response_sender.Run(response.Pass()); | 437 response_sender.Run(response.Pass()); |
436 } else { | 438 } else { |
437 // Return error. | 439 // Return error. |
438 response_sender.Run(scoped_ptr<Response>()); | 440 response_sender.Run(scoped_ptr<Response>()); |
439 return; | 441 return; |
440 } | 442 } |
441 } | 443 } |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 dict_entry_writer.OpenVariant("ao", &variant_writer); | 625 dict_entry_writer.OpenVariant("ao", &variant_writer); |
624 variant_writer.OpenArray("o", &variant_array_writer); | 626 variant_writer.OpenArray("o", &variant_array_writer); |
625 variant_array_writer.AppendObjectPath(ObjectPath("/TestObjectPath")); | 627 variant_array_writer.AppendObjectPath(ObjectPath("/TestObjectPath")); |
626 variant_writer.CloseContainer(&variant_array_writer); | 628 variant_writer.CloseContainer(&variant_array_writer); |
627 dict_entry_writer.CloseContainer(&variant_writer); | 629 dict_entry_writer.CloseContainer(&variant_writer); |
628 array_writer.CloseContainer(&dict_entry_writer); | 630 array_writer.CloseContainer(&dict_entry_writer); |
629 | 631 |
630 array_writer.OpenDictEntry(&dict_entry_writer); | 632 array_writer.OpenDictEntry(&dict_entry_writer); |
631 dict_entry_writer.AppendString("Bytes"); | 633 dict_entry_writer.AppendString("Bytes"); |
632 dict_entry_writer.OpenVariant("ay", &variant_writer); | 634 dict_entry_writer.OpenVariant("ay", &variant_writer); |
633 const uint8 bytes[] = { 0x54, 0x65, 0x73, 0x74 }; | 635 const uint8_t bytes[] = {0x54, 0x65, 0x73, 0x74}; |
634 variant_writer.AppendArrayOfBytes(bytes, sizeof(bytes)); | 636 variant_writer.AppendArrayOfBytes(bytes, sizeof(bytes)); |
635 dict_entry_writer.CloseContainer(&variant_writer); | 637 dict_entry_writer.CloseContainer(&variant_writer); |
636 array_writer.CloseContainer(&dict_entry_writer); | 638 array_writer.CloseContainer(&dict_entry_writer); |
637 | 639 |
638 writer->CloseContainer(&array_writer); | 640 writer->CloseContainer(&array_writer); |
639 } | 641 } |
640 | 642 |
641 void TestService::AddObject(const ObjectPath& object_path) { | 643 void TestService::AddObject(const ObjectPath& object_path) { |
642 message_loop()->PostTask( | 644 message_loop()->PostTask( |
643 FROM_HERE, | 645 FROM_HERE, |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 MessageWriter invalidated_array_writer(NULL); | 737 MessageWriter invalidated_array_writer(NULL); |
736 | 738 |
737 writer.OpenArray("s", &invalidated_array_writer); | 739 writer.OpenArray("s", &invalidated_array_writer); |
738 invalidated_array_writer.AppendString("Name"); | 740 invalidated_array_writer.AppendString("Name"); |
739 writer.CloseContainer(&invalidated_array_writer); | 741 writer.CloseContainer(&invalidated_array_writer); |
740 | 742 |
741 exported_object_->SendSignal(&signal); | 743 exported_object_->SendSignal(&signal); |
742 } | 744 } |
743 | 745 |
744 } // namespace dbus | 746 } // namespace dbus |
OLD | NEW |