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..400aa6a132815ff872c66825543b34f4069388c1 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,6 +44,25 @@ KeyedService* TetherServiceFactory::BuildServiceInstanceFor( |
content::BrowserContext* context) const { |
DCHECK(chromeos::NetworkHandler::IsInitialized()); |
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
+ if (command_line->HasSwitch(chromeos::switches::kTetherStub)) { |
+ FakeTetherService* fake_tether_service = new FakeTetherService( |
+ Profile::FromBrowserContext(context), |
+ chromeos::DBusThreadManager::Get()->GetPowerManagerClient(), |
+ chromeos::DBusThreadManager::Get()->GetSessionManagerClient(), |
+ ChromeCryptAuthServiceFactory::GetForBrowserContext( |
+ Profile::FromBrowserContext(context)), |
+ chromeos::NetworkHandler::Get()->network_state_handler()); |
+ |
+ int num_tether_networks = 0; |
+ base::StringToInt( |
+ command_line->GetSwitchValueASCII(chromeos::switches::kTetherStub), |
+ &num_tether_networks); |
+ fake_tether_service->set_num_tether_networks(num_tether_networks); |
+ |
+ return fake_tether_service; |
+ } |
+ |
return new TetherService( |
Profile::FromBrowserContext(context), |
chromeos::DBusThreadManager::Get()->GetPowerManagerClient(), |