| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/values.h" | 6 #include "base/values.h" |
| 7 #include "chromeos/dbus/shill_client_unittest_base.h" | 7 #include "chromeos/dbus/shill_client_unittest_base.h" |
| 8 #include "chromeos/dbus/shill_profile_client.h" | 8 #include "chromeos/dbus/shill_profile_client.h" |
| 9 #include "dbus/message.h" | 9 #include "dbus/message.h" |
| 10 #include "dbus/object_path.h" | 10 #include "dbus/object_path.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 // Create a signal. | 59 // Create a signal. |
| 60 dbus::Signal signal(shill::kFlimflamProfileInterface, | 60 dbus::Signal signal(shill::kFlimflamProfileInterface, |
| 61 shill::kMonitorPropertyChanged); | 61 shill::kMonitorPropertyChanged); |
| 62 dbus::MessageWriter writer(&signal); | 62 dbus::MessageWriter writer(&signal); |
| 63 writer.AppendString(shill::kEntriesProperty); | 63 writer.AppendString(shill::kEntriesProperty); |
| 64 AppendVariantOfArrayOfStrings(&writer, | 64 AppendVariantOfArrayOfStrings(&writer, |
| 65 std::vector<std::string>(1, kExampleEntryPath)); | 65 std::vector<std::string>(1, kExampleEntryPath)); |
| 66 | 66 |
| 67 // Set expectations. | 67 // Set expectations. |
| 68 base::ListValue value; | 68 base::ListValue value; |
| 69 value.Append(base::Value::CreateStringValue(kExampleEntryPath)); | 69 value.Append(new base::StringValue(kExampleEntryPath)); |
| 70 MockPropertyChangeObserver observer; | 70 MockPropertyChangeObserver observer; |
| 71 EXPECT_CALL(observer, | 71 EXPECT_CALL(observer, |
| 72 OnPropertyChanged( | 72 OnPropertyChanged( |
| 73 shill::kEntriesProperty, | 73 shill::kEntriesProperty, |
| 74 ValueEq(value))).Times(1); | 74 ValueEq(value))).Times(1); |
| 75 | 75 |
| 76 // Add the observer | 76 // Add the observer |
| 77 client_->AddPropertyChangedObserver( | 77 client_->AddPropertyChangedObserver( |
| 78 dbus::ObjectPath(kDefaultProfilePath), | 78 dbus::ObjectPath(kDefaultProfilePath), |
| 79 &observer); | 79 &observer); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 101 dbus::MessageWriter entry_writer(NULL); | 101 dbus::MessageWriter entry_writer(NULL); |
| 102 array_writer.OpenDictEntry(&entry_writer); | 102 array_writer.OpenDictEntry(&entry_writer); |
| 103 entry_writer.AppendString(shill::kEntriesProperty); | 103 entry_writer.AppendString(shill::kEntriesProperty); |
| 104 AppendVariantOfArrayOfStrings(&entry_writer, | 104 AppendVariantOfArrayOfStrings(&entry_writer, |
| 105 std::vector<std::string>(1, kExampleEntryPath)); | 105 std::vector<std::string>(1, kExampleEntryPath)); |
| 106 array_writer.CloseContainer(&entry_writer); | 106 array_writer.CloseContainer(&entry_writer); |
| 107 writer.CloseContainer(&array_writer); | 107 writer.CloseContainer(&array_writer); |
| 108 | 108 |
| 109 // Create the expected value. | 109 // Create the expected value. |
| 110 base::ListValue* entries = new base::ListValue; | 110 base::ListValue* entries = new base::ListValue; |
| 111 entries->Append(base::Value::CreateStringValue(kExampleEntryPath)); | 111 entries->Append(new base::StringValue(kExampleEntryPath)); |
| 112 base::DictionaryValue value; | 112 base::DictionaryValue value; |
| 113 value.SetWithoutPathExpansion(shill::kEntriesProperty, entries); | 113 value.SetWithoutPathExpansion(shill::kEntriesProperty, entries); |
| 114 // Set expectations. | 114 // Set expectations. |
| 115 PrepareForMethodCall(shill::kGetPropertiesFunction, | 115 PrepareForMethodCall(shill::kGetPropertiesFunction, |
| 116 base::Bind(&ExpectNoArgument), | 116 base::Bind(&ExpectNoArgument), |
| 117 response.get()); | 117 response.get()); |
| 118 // Call method. | 118 // Call method. |
| 119 MockErrorCallback error_callback; | 119 MockErrorCallback error_callback; |
| 120 client_->GetProperties(dbus::ObjectPath(kDefaultProfilePath), | 120 client_->GetProperties(dbus::ObjectPath(kDefaultProfilePath), |
| 121 base::Bind(&ExpectDictionaryValueResultWithoutStatus, | 121 base::Bind(&ExpectDictionaryValueResultWithoutStatus, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 135 writer.OpenArray("{sv}", &array_writer); | 135 writer.OpenArray("{sv}", &array_writer); |
| 136 dbus::MessageWriter entry_writer(NULL); | 136 dbus::MessageWriter entry_writer(NULL); |
| 137 array_writer.OpenDictEntry(&entry_writer); | 137 array_writer.OpenDictEntry(&entry_writer); |
| 138 entry_writer.AppendString(shill::kTypeProperty); | 138 entry_writer.AppendString(shill::kTypeProperty); |
| 139 entry_writer.AppendVariantOfString(shill::kTypeWifi); | 139 entry_writer.AppendVariantOfString(shill::kTypeWifi); |
| 140 array_writer.CloseContainer(&entry_writer); | 140 array_writer.CloseContainer(&entry_writer); |
| 141 writer.CloseContainer(&array_writer); | 141 writer.CloseContainer(&array_writer); |
| 142 | 142 |
| 143 // Create the expected value. | 143 // Create the expected value. |
| 144 base::DictionaryValue value; | 144 base::DictionaryValue value; |
| 145 value.SetWithoutPathExpansion( | 145 value.SetWithoutPathExpansion(shill::kTypeProperty, |
| 146 shill::kTypeProperty, | 146 new base::StringValue(shill::kTypeWifi)); |
| 147 base::Value::CreateStringValue(shill::kTypeWifi)); | |
| 148 // Set expectations. | 147 // Set expectations. |
| 149 PrepareForMethodCall(shill::kGetEntryFunction, | 148 PrepareForMethodCall(shill::kGetEntryFunction, |
| 150 base::Bind(&ExpectStringArgument, kExampleEntryPath), | 149 base::Bind(&ExpectStringArgument, kExampleEntryPath), |
| 151 response.get()); | 150 response.get()); |
| 152 // Call method. | 151 // Call method. |
| 153 MockErrorCallback error_callback; | 152 MockErrorCallback error_callback; |
| 154 client_->GetEntry(dbus::ObjectPath(kDefaultProfilePath), | 153 client_->GetEntry(dbus::ObjectPath(kDefaultProfilePath), |
| 155 kExampleEntryPath, | 154 kExampleEntryPath, |
| 156 base::Bind(&ExpectDictionaryValueResultWithoutStatus, | 155 base::Bind(&ExpectDictionaryValueResultWithoutStatus, |
| 157 &value), | 156 &value), |
| (...skipping 23 matching lines...) Expand all Loading... |
| 181 mock_closure.GetCallback(), | 180 mock_closure.GetCallback(), |
| 182 mock_error_callback.GetCallback()); | 181 mock_error_callback.GetCallback()); |
| 183 EXPECT_CALL(mock_closure, Run()).Times(1); | 182 EXPECT_CALL(mock_closure, Run()).Times(1); |
| 184 EXPECT_CALL(mock_error_callback, Run(_, _)).Times(0); | 183 EXPECT_CALL(mock_error_callback, Run(_, _)).Times(0); |
| 185 | 184 |
| 186 // Run the message loop. | 185 // Run the message loop. |
| 187 message_loop_.RunUntilIdle(); | 186 message_loop_.RunUntilIdle(); |
| 188 } | 187 } |
| 189 | 188 |
| 190 } // namespace chromeos | 189 } // namespace chromeos |
| OLD | NEW |