Index: chrome/browser/chromeos/tether/tether_service_factory.cc |
diff --git a/chrome/browser/chromeos/tether/tether_service_factory.cc b/chrome/browser/chromeos/tether/tether_service_factory.cc |
index da33cc9260605bc7eb70ff385cc0e8cb5adab31c..eef06b3b6c1e080e3ded977a482b950a15addbe5 100644 |
--- a/chrome/browser/chromeos/tether/tether_service_factory.cc |
+++ b/chrome/browser/chromeos/tether/tether_service_factory.cc |
@@ -4,10 +4,14 @@ |
#include "chrome/browser/chromeos/tether/tether_service_factory.h" |
+#include "base/command_line.h" |
#include "base/memory/singleton.h" |
+#include "base/strings/string_number_conversions.h" |
+#include "chrome/browser/chromeos/tether/fake_tether_service.h" |
#include "chrome/browser/cryptauth/chrome_cryptauth_service_factory.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/common/pref_names.h" |
+#include "chromeos/chromeos_switches.h" |
#include "chromeos/dbus/dbus_thread_manager.h" |
#include "chromeos/network/network_handler.h" |
#include "chromeos/network/network_state_handler.h" |
@@ -40,13 +44,29 @@ KeyedService* TetherServiceFactory::BuildServiceInstanceFor( |
content::BrowserContext* context) const { |
DCHECK(chromeos::NetworkHandler::IsInitialized()); |
- return new TetherService( |
- Profile::FromBrowserContext(context), |
- chromeos::DBusThreadManager::Get()->GetPowerManagerClient(), |
- chromeos::DBusThreadManager::Get()->GetSessionManagerClient(), |
- ChromeCryptAuthServiceFactory::GetForBrowserContext( |
- Profile::FromBrowserContext(context)), |
- chromeos::NetworkHandler::Get()->network_state_handler()); |
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
+ if (command_line->HasSwitch(chromeos::switches::kTetherStub)) { |
+ int num_tether_networks = 0; |
+ base::StringToInt( |
+ command_line->GetSwitchValueASCII(chromeos::switches::kTetherStub), |
+ &num_tether_networks); |
+ |
+ return new FakeTetherService( |
+ num_tether_networks, Profile::FromBrowserContext(context), |
+ chromeos::DBusThreadManager::Get()->GetPowerManagerClient(), |
+ chromeos::DBusThreadManager::Get()->GetSessionManagerClient(), |
+ ChromeCryptAuthServiceFactory::GetForBrowserContext( |
+ Profile::FromBrowserContext(context)), |
+ chromeos::NetworkHandler::Get()->network_state_handler()); |
+ } else { |
stevenjb
2017/05/23 22:24:33
no else
Ryan Hansberry
2017/05/23 22:53:12
Done.
|
+ return new TetherService( |
+ Profile::FromBrowserContext(context), |
+ chromeos::DBusThreadManager::Get()->GetPowerManagerClient(), |
+ chromeos::DBusThreadManager::Get()->GetSessionManagerClient(), |
+ ChromeCryptAuthServiceFactory::GetForBrowserContext( |
+ Profile::FromBrowserContext(context)), |
+ chromeos::NetworkHandler::Get()->network_state_handler()); |
+ } |
} |
void TetherServiceFactory::RegisterProfilePrefs( |