| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chromeos/dbus/shill_client_unittest_base.h" | 10 #include "chromeos/dbus/shill_client_unittest_base.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 // Append MTU. | 99 // Append MTU. |
| 100 array_writer.OpenDictEntry(&entry_writer); | 100 array_writer.OpenDictEntry(&entry_writer); |
| 101 entry_writer.AppendString(shill::kMtuProperty); | 101 entry_writer.AppendString(shill::kMtuProperty); |
| 102 entry_writer.AppendVariantOfInt32(kMtu); | 102 entry_writer.AppendVariantOfInt32(kMtu); |
| 103 array_writer.CloseContainer(&entry_writer); | 103 array_writer.CloseContainer(&entry_writer); |
| 104 writer.CloseContainer(&array_writer); | 104 writer.CloseContainer(&array_writer); |
| 105 | 105 |
| 106 // Create the expected value. | 106 // Create the expected value. |
| 107 base::DictionaryValue value; | 107 base::DictionaryValue value; |
| 108 value.SetWithoutPathExpansion(shill::kAddressProperty, | 108 value.SetWithoutPathExpansion(shill::kAddressProperty, |
| 109 new base::StringValue(kAddress)); | 109 new base::Value(kAddress)); |
| 110 value.SetWithoutPathExpansion(shill::kMtuProperty, new base::Value(kMtu)); | 110 value.SetWithoutPathExpansion(shill::kMtuProperty, new base::Value(kMtu)); |
| 111 | 111 |
| 112 // Set expectations. | 112 // Set expectations. |
| 113 PrepareForMethodCall(shill::kGetPropertiesFunction, | 113 PrepareForMethodCall(shill::kGetPropertiesFunction, |
| 114 base::Bind(&ExpectNoArgument), | 114 base::Bind(&ExpectNoArgument), |
| 115 response.get()); | 115 response.get()); |
| 116 // Call method. | 116 // Call method. |
| 117 client_->GetProperties(dbus::ObjectPath(kExampleIPConfigPath), | 117 client_->GetProperties(dbus::ObjectPath(kExampleIPConfigPath), |
| 118 base::Bind(&ExpectDictionaryValueResult, &value)); | 118 base::Bind(&ExpectDictionaryValueResult, &value)); |
| 119 // Run the message loop. | 119 // Run the message loop. |
| 120 base::RunLoop().RunUntilIdle(); | 120 base::RunLoop().RunUntilIdle(); |
| 121 } | 121 } |
| 122 | 122 |
| 123 TEST_F(ShillIPConfigClientTest, SetProperty) { | 123 TEST_F(ShillIPConfigClientTest, SetProperty) { |
| 124 const char kAddress[] = "address"; | 124 const char kAddress[] = "address"; |
| 125 | 125 |
| 126 // Create response. | 126 // Create response. |
| 127 std::unique_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); | 127 std::unique_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); |
| 128 | 128 |
| 129 // Set expectations. | 129 // Set expectations. |
| 130 base::StringValue value(kAddress); | 130 base::Value value(kAddress); |
| 131 PrepareForMethodCall(shill::kSetPropertyFunction, | 131 PrepareForMethodCall(shill::kSetPropertyFunction, |
| 132 base::Bind(&ExpectStringAndValueArguments, | 132 base::Bind(&ExpectStringAndValueArguments, |
| 133 shill::kAddressProperty, | 133 shill::kAddressProperty, |
| 134 &value), | 134 &value), |
| 135 response.get()); | 135 response.get()); |
| 136 // Call method. | 136 // Call method. |
| 137 client_->SetProperty(dbus::ObjectPath(kExampleIPConfigPath), | 137 client_->SetProperty(dbus::ObjectPath(kExampleIPConfigPath), |
| 138 shill::kAddressProperty, | 138 shill::kAddressProperty, |
| 139 value, | 139 value, |
| 140 base::Bind(&ExpectNoResultValue)); | 140 base::Bind(&ExpectNoResultValue)); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 169 response.get()); | 169 response.get()); |
| 170 // Call method. | 170 // Call method. |
| 171 client_->Remove(dbus::ObjectPath(kExampleIPConfigPath), | 171 client_->Remove(dbus::ObjectPath(kExampleIPConfigPath), |
| 172 base::Bind(&ExpectNoResultValue)); | 172 base::Bind(&ExpectNoResultValue)); |
| 173 | 173 |
| 174 // Run the message loop. | 174 // Run the message loop. |
| 175 base::RunLoop().RunUntilIdle(); | 175 base::RunLoop().RunUntilIdle(); |
| 176 } | 176 } |
| 177 | 177 |
| 178 } // namespace chromeos | 178 } // namespace chromeos |
| OLD | NEW |