| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 } | 43 } |
| 44 | 44 |
| 45 void TearDown() override { ShillClientUnittestBase::TearDown(); } | 45 void TearDown() override { ShillClientUnittestBase::TearDown(); } |
| 46 | 46 |
| 47 protected: | 47 protected: |
| 48 std::unique_ptr<ShillIPConfigClient> client_; | 48 std::unique_ptr<ShillIPConfigClient> client_; |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 TEST_F(ShillIPConfigClientTest, PropertyChanged) { | 51 TEST_F(ShillIPConfigClientTest, PropertyChanged) { |
| 52 // Create a signal. | 52 // Create a signal. |
| 53 const base::FundamentalValue kConnected(true); | 53 const base::Value kConnected(true); |
| 54 dbus::Signal signal(shill::kFlimflamIPConfigInterface, | 54 dbus::Signal signal(shill::kFlimflamIPConfigInterface, |
| 55 shill::kMonitorPropertyChanged); | 55 shill::kMonitorPropertyChanged); |
| 56 dbus::MessageWriter writer(&signal); | 56 dbus::MessageWriter writer(&signal); |
| 57 writer.AppendString(shill::kConnectedProperty); | 57 writer.AppendString(shill::kConnectedProperty); |
| 58 dbus::AppendBasicTypeValueDataAsVariant(&writer, kConnected); | 58 dbus::AppendBasicTypeValueDataAsVariant(&writer, kConnected); |
| 59 | 59 |
| 60 // Set expectations. | 60 // Set expectations. |
| 61 MockPropertyChangeObserver observer; | 61 MockPropertyChangeObserver observer; |
| 62 EXPECT_CALL(observer, OnPropertyChanged(shill::kConnectedProperty, | 62 EXPECT_CALL(observer, OnPropertyChanged(shill::kConnectedProperty, |
| 63 ValueEq(ByRef(kConnected)))).Times(1); | 63 ValueEq(ByRef(kConnected)))).Times(1); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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::StringValue(kAddress)); |
| 110 value.SetWithoutPathExpansion(shill::kMtuProperty, | 110 value.SetWithoutPathExpansion(shill::kMtuProperty, new base::Value(kMtu)); |
| 111 new base::FundamentalValue(kMtu)); | |
| 112 | 111 |
| 113 // Set expectations. | 112 // Set expectations. |
| 114 PrepareForMethodCall(shill::kGetPropertiesFunction, | 113 PrepareForMethodCall(shill::kGetPropertiesFunction, |
| 115 base::Bind(&ExpectNoArgument), | 114 base::Bind(&ExpectNoArgument), |
| 116 response.get()); | 115 response.get()); |
| 117 // Call method. | 116 // Call method. |
| 118 client_->GetProperties(dbus::ObjectPath(kExampleIPConfigPath), | 117 client_->GetProperties(dbus::ObjectPath(kExampleIPConfigPath), |
| 119 base::Bind(&ExpectDictionaryValueResult, &value)); | 118 base::Bind(&ExpectDictionaryValueResult, &value)); |
| 120 // Run the message loop. | 119 // Run the message loop. |
| 121 base::RunLoop().RunUntilIdle(); | 120 base::RunLoop().RunUntilIdle(); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 response.get()); | 169 response.get()); |
| 171 // Call method. | 170 // Call method. |
| 172 client_->Remove(dbus::ObjectPath(kExampleIPConfigPath), | 171 client_->Remove(dbus::ObjectPath(kExampleIPConfigPath), |
| 173 base::Bind(&ExpectNoResultValue)); | 172 base::Bind(&ExpectNoResultValue)); |
| 174 | 173 |
| 175 // Run the message loop. | 174 // Run the message loop. |
| 176 base::RunLoop().RunUntilIdle(); | 175 base::RunLoop().RunUntilIdle(); |
| 177 } | 176 } |
| 178 | 177 |
| 179 } // namespace chromeos | 178 } // namespace chromeos |
| OLD | NEW |