| OLD | NEW |
| 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/callback.h" | 5 #include "base/callback.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
| 8 #include "chrome/browser/chromeos/login/user.h" | 8 #include "chrome/browser/chromeos/login/user.h" |
| 9 #include "chrome/browser/chromeos/login/user_manager.h" | 9 #include "chrome/browser/chromeos/login/user_manager.h" |
| 10 #include "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #include "third_party/cros_system_api/dbus/service_constants.h" | 30 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 31 #endif // OS_CHROMEOS | 31 #endif // OS_CHROMEOS |
| 32 using testing::AnyNumber; | 32 using testing::AnyNumber; |
| 33 using testing::Return; | 33 using testing::Return; |
| 34 using testing::_; | 34 using testing::_; |
| 35 | 35 |
| 36 namespace chromeos { | 36 namespace chromeos { |
| 37 | 37 |
| 38 #if defined(OS_CHROMEOS) | 38 #if defined(OS_CHROMEOS) |
| 39 const char kUser1ProfilePath[] = "/profile/user1/shill"; | 39 const char kUser1ProfilePath[] = "/profile/user1/shill"; |
| 40 const char kUserIdStubHashSuffix[] = "-hash"; | |
| 41 #endif // defined(OS_CHROMEOS) | 40 #endif // defined(OS_CHROMEOS) |
| 42 | 41 |
| 43 | 42 |
| 44 class ExtensionNetworkingPrivateApiTest : | 43 class ExtensionNetworkingPrivateApiTest : |
| 45 public ExtensionApiTest, | 44 public ExtensionApiTest, |
| 46 public testing::WithParamInterface<bool> { | 45 public testing::WithParamInterface<bool> { |
| 47 public: | 46 public: |
| 48 bool RunNetworkingSubtest(const std::string& subtest) { | 47 bool RunNetworkingSubtest(const std::string& subtest) { |
| 49 return RunExtensionSubtest( | 48 return RunExtensionSubtest( |
| 50 "networking", "main.html?" + subtest, | 49 "networking", "main.html?" + subtest, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 71 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 70 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 72 ExtensionApiTest::SetUpCommandLine(command_line); | 71 ExtensionApiTest::SetUpCommandLine(command_line); |
| 73 // Whitelist the extension ID of the test extension. | 72 // Whitelist the extension ID of the test extension. |
| 74 command_line->AppendSwitchASCII(::switches::kWhitelistedExtensionID, | 73 command_line->AppendSwitchASCII(::switches::kWhitelistedExtensionID, |
| 75 "epcifkihnkjgphfkloaaleeakhpmgdmn"); | 74 "epcifkihnkjgphfkloaaleeakhpmgdmn"); |
| 76 | 75 |
| 77 // TODO(pneubeck): Remove the following hack, once the NetworkingPrivateAPI | 76 // TODO(pneubeck): Remove the following hack, once the NetworkingPrivateAPI |
| 78 // uses the ProfileHelper to obtain the userhash crbug/238623. | 77 // uses the ProfileHelper to obtain the userhash crbug/238623. |
| 79 std::string login_user = | 78 std::string login_user = |
| 80 command_line->GetSwitchValueNative(switches::kLoginUser); | 79 command_line->GetSwitchValueNative(switches::kLoginUser); |
| 81 // Do the same as CryptohomeClientStubImpl::GetSanitizedUsername | 80 std::string sanitized_user = CryptohomeClient::GetStubSanitizedUsername( |
| 82 std::string sanitized_user = login_user + kUserIdStubHashSuffix; | 81 login_user); |
| 83 command_line->AppendSwitchASCII(switches::kLoginProfile, sanitized_user); | 82 command_line->AppendSwitchASCII(switches::kLoginProfile, sanitized_user); |
| 84 if (GetParam()) | 83 if (GetParam()) |
| 85 command_line->AppendSwitch(::switches::kMultiProfiles); | 84 command_line->AppendSwitch(::switches::kMultiProfiles); |
| 86 } | 85 } |
| 87 | 86 |
| 88 void InitializeSanitizedUsername() { | 87 void InitializeSanitizedUsername() { |
| 89 chromeos::UserManager* user_manager = chromeos::UserManager::Get(); | 88 chromeos::UserManager* user_manager = chromeos::UserManager::Get(); |
| 90 chromeos::User* user = user_manager->GetActiveUser(); | 89 chromeos::User* user = user_manager->GetActiveUser(); |
| 91 CHECK(user); | 90 CHECK(user); |
| 92 std::string userhash; | 91 std::string userhash; |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, | 365 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, |
| 367 VerifyAndEncryptData) { | 366 VerifyAndEncryptData) { |
| 368 EXPECT_TRUE(RunNetworkingSubtest("verifyAndEncryptData")) << message_; | 367 EXPECT_TRUE(RunNetworkingSubtest("verifyAndEncryptData")) << message_; |
| 369 } | 368 } |
| 370 | 369 |
| 371 INSTANTIATE_TEST_CASE_P(ExtensionNetworkingPrivateApiTestInstantiation, | 370 INSTANTIATE_TEST_CASE_P(ExtensionNetworkingPrivateApiTestInstantiation, |
| 372 ExtensionNetworkingPrivateApiTest, | 371 ExtensionNetworkingPrivateApiTest, |
| 373 testing::Bool()); | 372 testing::Bool()); |
| 374 | 373 |
| 375 } // namespace chromeos | 374 } // namespace chromeos |
| OLD | NEW |