| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <stdint.h> |
| 6 |
| 5 #include "base/bind.h" | 7 #include "base/bind.h" |
| 6 #include "base/location.h" | 8 #include "base/location.h" |
| 7 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 8 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| 9 #include "chromeos/dbus/fake_gsm_sms_client.h" | 11 #include "chromeos/dbus/fake_gsm_sms_client.h" |
| 10 | 12 |
| 11 namespace chromeos { | 13 namespace chromeos { |
| 12 | 14 |
| 13 FakeGsmSMSClient::FakeGsmSMSClient() | 15 FakeGsmSMSClient::FakeGsmSMSClient() |
| 14 : test_index_(-1), | 16 : test_index_(-1), |
| (...skipping 23 matching lines...) Expand all Loading... |
| 38 } | 40 } |
| 39 | 41 |
| 40 void FakeGsmSMSClient::ResetSmsReceivedHandler( | 42 void FakeGsmSMSClient::ResetSmsReceivedHandler( |
| 41 const std::string& service_name, | 43 const std::string& service_name, |
| 42 const dbus::ObjectPath& object_path) { | 44 const dbus::ObjectPath& object_path) { |
| 43 handler_.Reset(); | 45 handler_.Reset(); |
| 44 } | 46 } |
| 45 | 47 |
| 46 void FakeGsmSMSClient::Delete(const std::string& service_name, | 48 void FakeGsmSMSClient::Delete(const std::string& service_name, |
| 47 const dbus::ObjectPath& object_path, | 49 const dbus::ObjectPath& object_path, |
| 48 uint32 index, | 50 uint32_t index, |
| 49 const DeleteCallback& callback) { | 51 const DeleteCallback& callback) { |
| 50 message_list_.Remove(index, NULL); | 52 message_list_.Remove(index, NULL); |
| 51 callback.Run(); | 53 callback.Run(); |
| 52 } | 54 } |
| 53 | 55 |
| 54 void FakeGsmSMSClient::Get(const std::string& service_name, | 56 void FakeGsmSMSClient::Get(const std::string& service_name, |
| 55 const dbus::ObjectPath& object_path, | 57 const dbus::ObjectPath& object_path, |
| 56 uint32 index, | 58 uint32_t index, |
| 57 const GetCallback& callback) { | 59 const GetCallback& callback) { |
| 58 base::DictionaryValue* dictionary = NULL; | 60 base::DictionaryValue* dictionary = NULL; |
| 59 if (message_list_.GetDictionary(index, &dictionary)) { | 61 if (message_list_.GetDictionary(index, &dictionary)) { |
| 60 callback.Run(*dictionary); | 62 callback.Run(*dictionary); |
| 61 return; | 63 return; |
| 62 } | 64 } |
| 63 base::DictionaryValue empty_dictionary; | 65 base::DictionaryValue empty_dictionary; |
| 64 callback.Run(empty_dictionary); | 66 callback.Run(empty_dictionary); |
| 65 } | 67 } |
| 66 | 68 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 message->SetInteger("index", test_index_); | 109 message->SetInteger("index", test_index_); |
| 108 int msg_index = message_list_.GetSize(); | 110 int msg_index = message_list_.GetSize(); |
| 109 message_list_.Append(message); | 111 message_list_.Append(message); |
| 110 if (!handler_.is_null()) | 112 if (!handler_.is_null()) |
| 111 handler_.Run(msg_index, true); | 113 handler_.Run(msg_index, true); |
| 112 ++test_index_; | 114 ++test_index_; |
| 113 return true; | 115 return true; |
| 114 } | 116 } |
| 115 | 117 |
| 116 } // namespace chromeos | 118 } // namespace chromeos |
| OLD | NEW |