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/run_loop.h" | 6 #include "base/run_loop.h" |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #include "chromeos/dbus/shill_client_unittest_base.h" | 8 #include "chromeos/dbus/shill_client_unittest_base.h" |
9 #include "chromeos/dbus/shill_profile_client.h" | 9 #include "chromeos/dbus/shill_profile_client.h" |
10 #include "dbus/message.h" | 10 #include "dbus/message.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 // Create a signal. | 58 // Create a signal. |
59 dbus::Signal signal(shill::kFlimflamProfileInterface, | 59 dbus::Signal signal(shill::kFlimflamProfileInterface, |
60 shill::kMonitorPropertyChanged); | 60 shill::kMonitorPropertyChanged); |
61 dbus::MessageWriter writer(&signal); | 61 dbus::MessageWriter writer(&signal); |
62 writer.AppendString(shill::kEntriesProperty); | 62 writer.AppendString(shill::kEntriesProperty); |
63 AppendVariantOfArrayOfStrings(&writer, | 63 AppendVariantOfArrayOfStrings(&writer, |
64 std::vector<std::string>(1, kExampleEntryPath)); | 64 std::vector<std::string>(1, kExampleEntryPath)); |
65 | 65 |
66 // Set expectations. | 66 // Set expectations. |
67 base::ListValue value; | 67 base::ListValue value; |
68 value.Append(new base::StringValue(kExampleEntryPath)); | 68 value.AppendString(kExampleEntryPath); |
69 MockPropertyChangeObserver observer; | 69 MockPropertyChangeObserver observer; |
70 EXPECT_CALL(observer, | 70 EXPECT_CALL(observer, |
71 OnPropertyChanged( | 71 OnPropertyChanged( |
72 shill::kEntriesProperty, | 72 shill::kEntriesProperty, |
73 ValueEq(value))).Times(1); | 73 ValueEq(value))).Times(1); |
74 | 74 |
75 // Add the observer | 75 // Add the observer |
76 client_->AddPropertyChangedObserver( | 76 client_->AddPropertyChangedObserver( |
77 dbus::ObjectPath(kDefaultProfilePath), | 77 dbus::ObjectPath(kDefaultProfilePath), |
78 &observer); | 78 &observer); |
(...skipping 21 matching lines...) Expand all Loading... |
100 dbus::MessageWriter entry_writer(NULL); | 100 dbus::MessageWriter entry_writer(NULL); |
101 array_writer.OpenDictEntry(&entry_writer); | 101 array_writer.OpenDictEntry(&entry_writer); |
102 entry_writer.AppendString(shill::kEntriesProperty); | 102 entry_writer.AppendString(shill::kEntriesProperty); |
103 AppendVariantOfArrayOfStrings(&entry_writer, | 103 AppendVariantOfArrayOfStrings(&entry_writer, |
104 std::vector<std::string>(1, kExampleEntryPath)); | 104 std::vector<std::string>(1, kExampleEntryPath)); |
105 array_writer.CloseContainer(&entry_writer); | 105 array_writer.CloseContainer(&entry_writer); |
106 writer.CloseContainer(&array_writer); | 106 writer.CloseContainer(&array_writer); |
107 | 107 |
108 // Create the expected value. | 108 // Create the expected value. |
109 base::ListValue* entries = new base::ListValue; | 109 base::ListValue* entries = new base::ListValue; |
110 entries->Append(new base::StringValue(kExampleEntryPath)); | 110 entries->AppendString(kExampleEntryPath); |
111 base::DictionaryValue value; | 111 base::DictionaryValue value; |
112 value.SetWithoutPathExpansion(shill::kEntriesProperty, entries); | 112 value.SetWithoutPathExpansion(shill::kEntriesProperty, entries); |
113 // Set expectations. | 113 // Set expectations. |
114 PrepareForMethodCall(shill::kGetPropertiesFunction, | 114 PrepareForMethodCall(shill::kGetPropertiesFunction, |
115 base::Bind(&ExpectNoArgument), | 115 base::Bind(&ExpectNoArgument), |
116 response.get()); | 116 response.get()); |
117 // Call method. | 117 // Call method. |
118 MockErrorCallback error_callback; | 118 MockErrorCallback error_callback; |
119 client_->GetProperties(dbus::ObjectPath(kDefaultProfilePath), | 119 client_->GetProperties(dbus::ObjectPath(kDefaultProfilePath), |
120 base::Bind(&ExpectDictionaryValueResultWithoutStatus, | 120 base::Bind(&ExpectDictionaryValueResultWithoutStatus, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 mock_closure.GetCallback(), | 179 mock_closure.GetCallback(), |
180 mock_error_callback.GetCallback()); | 180 mock_error_callback.GetCallback()); |
181 EXPECT_CALL(mock_closure, Run()).Times(1); | 181 EXPECT_CALL(mock_closure, Run()).Times(1); |
182 EXPECT_CALL(mock_error_callback, Run(_, _)).Times(0); | 182 EXPECT_CALL(mock_error_callback, Run(_, _)).Times(0); |
183 | 183 |
184 // Run the message loop. | 184 // Run the message loop. |
185 base::RunLoop().RunUntilIdle(); | 185 base::RunLoop().RunUntilIdle(); |
186 } | 186 } |
187 | 187 |
188 } // namespace chromeos | 188 } // namespace chromeos |
OLD | NEW |