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

Side by Side Diff: chrome/browser/extensions/api/networking_private/networking_private_apitest.cc

Issue 299403012: Clean up shill fake implementations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 6 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/callback.h" 6 #include "base/callback.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/chromeos/login/users/user.h" 10 #include "chrome/browser/chromeos/login/users/user.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 base::StringValue(shill::kRoamingStateHome)); 227 base::StringValue(shill::kRoamingStateHome));
228 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> 228 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()->
229 SortManagerServices(); 229 SortManagerServices();
230 content::RunAllPendingInMessageLoop(); 230 content::RunAllPendingInMessageLoop();
231 } 231 }
232 232
233 void AddService(const std::string& service_path, 233 void AddService(const std::string& service_path,
234 const std::string& name, 234 const std::string& name,
235 const std::string& type, 235 const std::string& type,
236 const std::string& state) { 236 const std::string& state) {
237 const bool add_to_watchlist = true;
238 const bool add_to_visible = true; 237 const bool add_to_visible = true;
239 // Tests need a known GUID, so use 'service_path'. 238 // Tests need a known GUID, so use 'service_path'.
240 service_test_->AddServiceWithIPConfig( 239 service_test_->AddServiceWithIPConfig(
241 service_path, service_path /* guid */, name, 240 service_path, service_path /* guid */, name,
242 type, state, "" /* ipconfig_path */, 241 type, state, "" /* ipconfig_path */,
243 add_to_visible, add_to_watchlist); 242 add_to_visible);
244 } 243 }
245 244
246 virtual void SetUpOnMainThread() OVERRIDE { 245 virtual void SetUpOnMainThread() OVERRIDE {
247 detector_ = new NetworkPortalDetectorTestImpl(); 246 detector_ = new NetworkPortalDetectorTestImpl();
248 NetworkPortalDetector::InitializeForTesting(detector_); 247 NetworkPortalDetector::InitializeForTesting(detector_);
249 248
250 ExtensionApiTest::SetUpOnMainThread(); 249 ExtensionApiTest::SetUpOnMainThread();
251 content::RunAllPendingInMessageLoop(); 250 content::RunAllPendingInMessageLoop();
252 251
253 InitializeSanitizedUsername(); 252 InitializeSanitizedUsername();
254 253
255 DBusThreadManager* dbus_manager = DBusThreadManager::Get(); 254 DBusThreadManager* dbus_manager = DBusThreadManager::Get();
256 manager_test_ = dbus_manager->GetShillManagerClient()->GetTestInterface(); 255 manager_test_ = dbus_manager->GetShillManagerClient()->GetTestInterface();
257 service_test_ = dbus_manager->GetShillServiceClient()->GetTestInterface(); 256 service_test_ = dbus_manager->GetShillServiceClient()->GetTestInterface();
258 device_test_ = dbus_manager->GetShillDeviceClient()->GetTestInterface(); 257 device_test_ = dbus_manager->GetShillDeviceClient()->GetTestInterface();
259 258
260 ShillIPConfigClient::TestInterface* ip_config_test = 259 ShillIPConfigClient::TestInterface* ip_config_test =
261 dbus_manager->GetShillIPConfigClient()->GetTestInterface(); 260 dbus_manager->GetShillIPConfigClient()->GetTestInterface();
262 ShillProfileClient::TestInterface* profile_test = 261 ShillProfileClient::TestInterface* profile_test =
263 dbus_manager->GetShillProfileClient()->GetTestInterface(); 262 dbus_manager->GetShillProfileClient()->GetTestInterface();
264 263
265 device_test_->ClearDevices(); 264 device_test_->ClearDevices();
266 service_test_->ClearServices(); 265 service_test_->ClearServices();
266 profile_test->ClearProfiles();
267 267
268 // Sends a notification about the added profile. 268 // Sends a notification about the added profile.
269 profile_test->AddProfile(kUser1ProfilePath, userhash_); 269 profile_test->AddProfile(kUser1ProfilePath, userhash_);
270 270
271 // Add IPConfigs 271 // Add IPConfigs
272 base::DictionaryValue ipconfig; 272 base::DictionaryValue ipconfig;
273 ipconfig.SetStringWithoutPathExpansion(shill::kAddressProperty, "0.0.0.0"); 273 ipconfig.SetStringWithoutPathExpansion(shill::kAddressProperty, "0.0.0.0");
274 ipconfig.SetStringWithoutPathExpansion(shill::kGatewayProperty, "0.0.0.1"); 274 ipconfig.SetStringWithoutPathExpansion(shill::kGatewayProperty, "0.0.0.1");
275 ipconfig.SetIntegerWithoutPathExpansion(shill::kPrefixlenProperty, 0); 275 ipconfig.SetIntegerWithoutPathExpansion(shill::kPrefixlenProperty, 0);
276 ipconfig.SetStringWithoutPathExpansion(shill::kMethodProperty, 276 ipconfig.SetStringWithoutPathExpansion(shill::kMethodProperty,
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 617
618 TestListener listener( 618 TestListener listener(
619 "notifyPortalDetectorObservers", 619 "notifyPortalDetectorObservers",
620 base::Bind(&NetworkPortalDetectorTestImpl::NotifyObserversForTesting, 620 base::Bind(&NetworkPortalDetectorTestImpl::NotifyObserversForTesting,
621 base::Unretained(detector()))); 621 base::Unretained(detector())));
622 EXPECT_TRUE(RunNetworkingSubtest("captivePortalNotification")) << message_; 622 EXPECT_TRUE(RunNetworkingSubtest("captivePortalNotification")) << message_;
623 } 623 }
624 #endif // defined(OS_CHROMEOS) 624 #endif // defined(OS_CHROMEOS)
625 625
626 } // namespace 626 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698