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

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

Issue 290123004: Canonicalize user ID passed via chromeos::switches::kLoginUser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix ExtensionNetworkingPrivateApiTestInstantiation tests. Created 6 years, 7 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 | « chrome/browser/chromeos/login/helper.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "chrome/browser/chromeos/login/users/user_manager.h" 11 #include "chrome/browser/chromeos/login/users/user_manager.h"
12 #include "chrome/browser/extensions/extension_apitest.h" 12 #include "chrome/browser/extensions/extension_apitest.h"
13 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
14 #include "chrome/test/base/ui_test_utils.h" 14 #include "chrome/test/base/ui_test_utils.h"
15 #include "extensions/common/switches.h" 15 #include "extensions/common/switches.h"
16 #include "testing/gmock/include/gmock/gmock.h" 16 #include "testing/gmock/include/gmock/gmock.h"
17 17
18 #if defined(OS_CHROMEOS) 18 #if defined(OS_CHROMEOS)
19 #include "chrome/browser/chrome_notification_types.h" 19 #include "chrome/browser/chrome_notification_types.h"
20 #include "chrome/browser/chromeos/login/helper.h"
20 #include "chrome/browser/chromeos/net/network_portal_detector.h" 21 #include "chrome/browser/chromeos/net/network_portal_detector.h"
21 #include "chrome/browser/chromeos/net/network_portal_detector_test_impl.h" 22 #include "chrome/browser/chromeos/net/network_portal_detector_test_impl.h"
22 #include "chromeos/chromeos_switches.h" 23 #include "chromeos/chromeos_switches.h"
23 #include "chromeos/dbus/cryptohome_client.h" 24 #include "chromeos/dbus/cryptohome_client.h"
24 #include "chromeos/dbus/dbus_thread_manager.h" 25 #include "chromeos/dbus/dbus_thread_manager.h"
25 #include "chromeos/dbus/shill_device_client.h" 26 #include "chromeos/dbus/shill_device_client.h"
26 #include "chromeos/dbus/shill_ipconfig_client.h" 27 #include "chromeos/dbus/shill_ipconfig_client.h"
27 #include "chromeos/dbus/shill_manager_client.h" 28 #include "chromeos/dbus/shill_manager_client.h"
28 #include "chromeos/dbus/shill_profile_client.h" 29 #include "chromeos/dbus/shill_profile_client.h"
29 #include "chromeos/dbus/shill_service_client.h" 30 #include "chromeos/dbus/shill_service_client.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 170
170 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 171 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
171 ExtensionApiTest::SetUpCommandLine(command_line); 172 ExtensionApiTest::SetUpCommandLine(command_line);
172 // Whitelist the extension ID of the test extension. 173 // Whitelist the extension ID of the test extension.
173 command_line->AppendSwitchASCII( 174 command_line->AppendSwitchASCII(
174 extensions::switches::kWhitelistedExtensionID, 175 extensions::switches::kWhitelistedExtensionID,
175 "epcifkihnkjgphfkloaaleeakhpmgdmn"); 176 "epcifkihnkjgphfkloaaleeakhpmgdmn");
176 177
177 // TODO(pneubeck): Remove the following hack, once the NetworkingPrivateAPI 178 // TODO(pneubeck): Remove the following hack, once the NetworkingPrivateAPI
178 // uses the ProfileHelper to obtain the userhash crbug/238623. 179 // uses the ProfileHelper to obtain the userhash crbug/238623.
179 std::string login_user = 180 const std::string login_user = chromeos::login::CanonicalizeUserID(
180 command_line->GetSwitchValueNative(chromeos::switches::kLoginUser); 181 command_line->GetSwitchValueNative(chromeos::switches::kLoginUser));
181 std::string sanitized_user = CryptohomeClient::GetStubSanitizedUsername( 182 const std::string sanitized_user =
182 login_user); 183 CryptohomeClient::GetStubSanitizedUsername(login_user);
183 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, 184 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile,
184 sanitized_user); 185 sanitized_user);
185 if (GetParam()) 186 if (GetParam())
186 command_line->AppendSwitch(::switches::kMultiProfiles); 187 command_line->AppendSwitch(::switches::kMultiProfiles);
187 } 188 }
188 189
189 void InitializeSanitizedUsername() { 190 void InitializeSanitizedUsername() {
190 chromeos::UserManager* user_manager = chromeos::UserManager::Get(); 191 chromeos::UserManager* user_manager = chromeos::UserManager::Get();
191 chromeos::User* user = user_manager->GetActiveUser(); 192 chromeos::User* user = user_manager->GetActiveUser();
192 CHECK(user); 193 CHECK(user);
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 base::Unretained(detector()))); 587 base::Unretained(detector())));
587 EXPECT_TRUE(RunNetworkingSubtest("captivePortalNotification")) << message_; 588 EXPECT_TRUE(RunNetworkingSubtest("captivePortalNotification")) << message_;
588 } 589 }
589 #endif // defined(OS_CHROMEOS) 590 #endif // defined(OS_CHROMEOS)
590 591
591 INSTANTIATE_TEST_CASE_P(ExtensionNetworkingPrivateApiTestInstantiation, 592 INSTANTIATE_TEST_CASE_P(ExtensionNetworkingPrivateApiTestInstantiation,
592 ExtensionNetworkingPrivateApiTest, 593 ExtensionNetworkingPrivateApiTest,
593 testing::Bool()); 594 testing::Bool());
594 595
595 } // namespace 596 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698