| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "chrome/browser/browser_process.h" | 6 #include "chrome/browser/browser_process.h" |
| 7 #include "chrome/browser/chromeos/login/user.h" | 7 #include "chrome/browser/chromeos/login/user.h" |
| 8 #include "chrome/browser/chromeos/login/user_manager.h" | 8 #include "chrome/browser/chromeos/login/user_manager.h" |
| 9 #include "chrome/browser/chromeos/policy/network_configuration_updater.h" | 9 #include "chrome/browser/chromeos/policy/network_configuration_updater.h" |
| 10 #include "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 using testing::AnyNumber; | 28 using testing::AnyNumber; |
| 29 using testing::Return; | 29 using testing::Return; |
| 30 using testing::_; | 30 using testing::_; |
| 31 | 31 |
| 32 namespace chromeos { | 32 namespace chromeos { |
| 33 | 33 |
| 34 namespace { | 34 namespace { |
| 35 | 35 |
| 36 const char kUser1ProfilePath[] = "/profile/user1/shill"; | 36 const char kUser1ProfilePath[] = "/profile/user1/shill"; |
| 37 const char kUserIdStubHashSuffix[] = "-hash"; |
| 37 | 38 |
| 38 void AssignString(std::string* out, | 39 void AssignString(std::string* out, |
| 39 DBusMethodCallStatus call_status, | 40 DBusMethodCallStatus call_status, |
| 40 const std::string& result) { | 41 const std::string& result) { |
| 41 CHECK_EQ(call_status, DBUS_METHOD_CALL_SUCCESS); | 42 CHECK_EQ(call_status, DBUS_METHOD_CALL_SUCCESS); |
| 42 *out = result; | 43 *out = result; |
| 43 } | 44 } |
| 44 | 45 |
| 45 } // namespace | 46 } // namespace |
| 46 | 47 |
| 47 class ExtensionNetworkingPrivateApiTest : public ExtensionApiTest { | 48 class ExtensionNetworkingPrivateApiTest : public ExtensionApiTest { |
| 48 public: | 49 public: |
| 49 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 50 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 50 ExtensionApiTest::SetUpCommandLine(command_line); | 51 ExtensionApiTest::SetUpCommandLine(command_line); |
| 51 // Whitelist the extension ID of the test extension. | 52 // Whitelist the extension ID of the test extension. |
| 52 command_line->AppendSwitchASCII(::switches::kWhitelistedExtensionID, | 53 command_line->AppendSwitchASCII(::switches::kWhitelistedExtensionID, |
| 53 "epcifkihnkjgphfkloaaleeakhpmgdmn"); | 54 "epcifkihnkjgphfkloaaleeakhpmgdmn"); |
| 54 command_line->AppendSwitch(switches::kUseNewNetworkConfigurationHandlers); | 55 command_line->AppendSwitch(switches::kUseNewNetworkConfigurationHandlers); |
| 55 | 56 |
| 56 // TODO(pneubeck): Remove the following hack, once the NetworkingPrivateAPI | 57 // TODO(pneubeck): Remove the following hack, once the NetworkingPrivateAPI |
| 57 // uses the ProfileHelper to obtain the userhash crbug/238623. | 58 // uses the ProfileHelper to obtain the userhash crbug/238623. |
| 58 std::string login_user = | 59 std::string login_user = |
| 59 command_line->GetSwitchValueNative(switches::kLoginUser); | 60 command_line->GetSwitchValueNative(switches::kLoginUser); |
| 60 // Do the same as CryptohomeClientStubImpl::GetSanitizedUsername | 61 // Do the same as CryptohomeClientStubImpl::GetSanitizedUsername |
| 61 std::string sanitized_user = login_user + "-profile"; | 62 std::string sanitized_user = login_user + kUserIdStubHashSuffix; |
| 62 command_line->AppendSwitchASCII(switches::kLoginProfile, sanitized_user); | 63 command_line->AppendSwitchASCII(switches::kLoginProfile, sanitized_user); |
| 63 } | 64 } |
| 64 | 65 |
| 65 bool RunNetworkingSubtest(const std::string& subtest) { | 66 bool RunNetworkingSubtest(const std::string& subtest) { |
| 66 return RunExtensionSubtest( | 67 return RunExtensionSubtest( |
| 67 "networking", "main.html?" + subtest, | 68 "networking", "main.html?" + subtest, |
| 68 kFlagEnableFileAccess | kFlagLoadAsComponent); | 69 kFlagEnableFileAccess | kFlagLoadAsComponent); |
| 69 } | 70 } |
| 70 | 71 |
| 71 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 72 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 EXPECT_TRUE(RunNetworkingSubtest("verifyAndEncryptCredentials")) << message_; | 309 EXPECT_TRUE(RunNetworkingSubtest("verifyAndEncryptCredentials")) << message_; |
| 309 } | 310 } |
| 310 | 311 |
| 311 IN_PROC_BROWSER_TEST_F(ExtensionNetworkingPrivateApiTest, | 312 IN_PROC_BROWSER_TEST_F(ExtensionNetworkingPrivateApiTest, |
| 312 VerifyAndEncryptData) { | 313 VerifyAndEncryptData) { |
| 313 EXPECT_TRUE(RunNetworkingSubtest("verifyAndEncryptData")) << message_; | 314 EXPECT_TRUE(RunNetworkingSubtest("verifyAndEncryptData")) << message_; |
| 314 } | 315 } |
| 315 | 316 |
| 316 | 317 |
| 317 } // namespace chromeos | 318 } // namespace chromeos |
| OLD | NEW |