Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: chromeos/dbus/flimflam_manager_client_unittest.cc

Issue 10202009: Reimplement CrosGetWifiAccessPoints without Libcros (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chromeos/dbus/flimflam_manager_client.cc ('k') | chromeos/dbus/mock_flimflam_manager_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/flimflam_client_unittest_base.h" 7 #include "chromeos/dbus/flimflam_client_unittest_base.h"
8 #include "chromeos/dbus/flimflam_manager_client.h" 8 #include "chromeos/dbus/flimflam_manager_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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 PrepareForMethodCall(flimflam::kGetPropertiesFunction, 162 PrepareForMethodCall(flimflam::kGetPropertiesFunction,
163 base::Bind(&ExpectNoArgument), 163 base::Bind(&ExpectNoArgument),
164 response.get()); 164 response.get());
165 // Call method. 165 // Call method.
166 client_->GetProperties(base::Bind(&ExpectDictionaryValueResult, 166 client_->GetProperties(base::Bind(&ExpectDictionaryValueResult,
167 &value)); 167 &value));
168 // Run the message loop. 168 // Run the message loop.
169 message_loop_.RunAllPending(); 169 message_loop_.RunAllPending();
170 } 170 }
171 171
172 TEST_F(FlimflamManagerClientTest, CallGetPropertiesAndBlock) {
173 // Create response.
174 scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty());
175 dbus::MessageWriter writer(response.get());
176 dbus::MessageWriter array_writer(NULL);
177 writer.OpenArray("{sv}", &array_writer);
178 dbus::MessageWriter entry_writer(NULL);
179 array_writer.OpenDictEntry(&entry_writer);
180 entry_writer.AppendString(flimflam::kOfflineModeProperty);
181 entry_writer.AppendVariantOfBool(true);
182 array_writer.CloseContainer(&entry_writer);
183 writer.CloseContainer(&array_writer);
184
185 // Create the expected value.
186 base::DictionaryValue value;
187 value.SetWithoutPathExpansion(flimflam::kOfflineModeProperty,
188 base::Value::CreateBooleanValue(true));
189 // Set expectations.
190 PrepareForMethodCall(flimflam::kGetPropertiesFunction,
191 base::Bind(&ExpectNoArgument),
192 response.get());
193 // Call method.
194 scoped_ptr<base::DictionaryValue> result(
195 client_->CallGetPropertiesAndBlock());
196 EXPECT_TRUE(value.Equals(result.get()));
197 }
198
172 TEST_F(FlimflamManagerClientTest, SetProperty) { 199 TEST_F(FlimflamManagerClientTest, SetProperty) {
173 // Create response. 200 // Create response.
174 scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); 201 scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty());
175 // Set expectations. 202 // Set expectations.
176 base::StringValue value("portal list"); 203 base::StringValue value("portal list");
177 PrepareForMethodCall(flimflam::kSetPropertyFunction, 204 PrepareForMethodCall(flimflam::kSetPropertyFunction,
178 base::Bind(ExpectStringAndValueArguments, 205 base::Bind(ExpectStringAndValueArguments,
179 flimflam::kCheckPortalListProperty, 206 flimflam::kCheckPortalListProperty,
180 &value), 207 &value),
181 response.get()); 208 response.get());
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 PrepareForMethodCall(flimflam::kGetServiceFunction, 282 PrepareForMethodCall(flimflam::kGetServiceFunction,
256 base::Bind(&ExpectDictionaryValueArgument, arg.get()), 283 base::Bind(&ExpectDictionaryValueArgument, arg.get()),
257 response.get()); 284 response.get());
258 // Call method. 285 // Call method.
259 client_->GetService(*arg, base::Bind(&ExpectObjectPathResult, object_path)); 286 client_->GetService(*arg, base::Bind(&ExpectObjectPathResult, object_path));
260 // Run the message loop. 287 // Run the message loop.
261 message_loop_.RunAllPending(); 288 message_loop_.RunAllPending();
262 } 289 }
263 290
264 } // namespace chromeos 291 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/flimflam_manager_client.cc ('k') | chromeos/dbus/mock_flimflam_manager_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698