| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/sync/test/integration/wifi_credentials_helper_chromeos.
h" | 5 #include "chrome/browser/sync/test/integration/wifi_credentials_helper_chromeos.
h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
| 14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "chromeos/dbus/dbus_thread_manager.h" | 16 #include "chromeos/dbus/dbus_thread_manager.h" |
| 17 #include "chromeos/dbus/shill_profile_client.h" | 17 #include "chromeos/dbus/shill_profile_client.h" |
| 18 #include "chromeos/network/managed_network_configuration_handler.h" | 18 #include "chromeos/network/managed_network_configuration_handler.h" |
| 19 #include "chromeos/network/network_handler.h" | 19 #include "chromeos/network/network_handler.h" |
| 20 #include "chromeos/network/network_state_handler.h" | 20 #include "chromeos/network/network_state_handler.h" |
| 21 #include "components/onc/onc_constants.h" | 21 #include "components/onc/onc_constants.h" |
| 22 #include "components/wifi_sync/network_state_helper_chromeos.h" | 22 #include "components/sync_wifi/network_state_helper_chromeos.h" |
| 23 #include "components/wifi_sync/wifi_credential_syncable_service_factory.h" | 23 #include "components/sync_wifi/wifi_credential_syncable_service_factory.h" |
| 24 #include "content/public/browser/browser_context.h" | 24 #include "content/public/browser/browser_context.h" |
| 25 | 25 |
| 26 using wifi_sync::WifiCredential; | 26 using sync_wifi::WifiCredential; |
| 27 | 27 |
| 28 using WifiCredentialSet = wifi_sync::WifiCredential::CredentialSet; | 28 using WifiCredentialSet = sync_wifi::WifiCredential::CredentialSet; |
| 29 | 29 |
| 30 namespace wifi_credentials_helper { | 30 namespace wifi_credentials_helper { |
| 31 | 31 |
| 32 namespace { | 32 namespace { |
| 33 | 33 |
| 34 const char kProfilePrefix[] = "/profile/"; | 34 const char kProfilePrefix[] = "/profile/"; |
| 35 | 35 |
| 36 void LogCreateConfigurationFailure( | 36 void LogCreateConfigurationFailure( |
| 37 const std::string& debug_hint, | 37 const std::string& debug_hint, |
| 38 const std::string& /* network_config_error_message */, | 38 const std::string& /* network_config_error_message */, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 ::chromeos::NetworkStateHandler* GetNetworkStateHandler() { | 71 ::chromeos::NetworkStateHandler* GetNetworkStateHandler() { |
| 72 DCHECK(::chromeos::NetworkHandler::Get()->network_state_handler()); | 72 DCHECK(::chromeos::NetworkHandler::Get()->network_state_handler()); |
| 73 return ::chromeos::NetworkHandler::Get()->network_state_handler(); | 73 return ::chromeos::NetworkHandler::Get()->network_state_handler(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 } // namespace | 76 } // namespace |
| 77 | 77 |
| 78 namespace chromeos { | 78 namespace chromeos { |
| 79 | 79 |
| 80 void SetUpChromeOs() { | 80 void SetUpChromeOs() { |
| 81 wifi_sync::WifiCredentialSyncableServiceFactory::GetInstance() | 81 sync_wifi::WifiCredentialSyncableServiceFactory::GetInstance() |
| 82 ->set_ignore_login_state_for_test(true); | 82 ->set_ignore_login_state_for_test(true); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void SetupClientForProfileChromeOs( | 85 void SetupClientForProfileChromeOs( |
| 86 const content::BrowserContext* browser_context) { | 86 const content::BrowserContext* browser_context) { |
| 87 DCHECK(browser_context); | 87 DCHECK(browser_context); |
| 88 GetShillProfileClientTestInterface() | 88 GetShillProfileClientTestInterface() |
| 89 ->AddProfile(ShillProfilePathForBrowserContext(*browser_context), | 89 ->AddProfile(ShillProfilePathForBrowserContext(*browser_context), |
| 90 ChromeOsUserHashForBrowserContext(*browser_context)); | 90 ChromeOsUserHashForBrowserContext(*browser_context)); |
| 91 | 91 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 111 ::chromeos::network_handler::ServiceResultCallback(), | 111 ::chromeos::network_handler::ServiceResultCallback(), |
| 112 base::Bind(LogCreateConfigurationFailure, | 112 base::Bind(LogCreateConfigurationFailure, |
| 113 base::StringPrintf("Failed to add credential %s", | 113 base::StringPrintf("Failed to add credential %s", |
| 114 credential.ToString().c_str()))); | 114 credential.ToString().c_str()))); |
| 115 base::RunLoop().RunUntilIdle(); | 115 base::RunLoop().RunUntilIdle(); |
| 116 } | 116 } |
| 117 | 117 |
| 118 WifiCredentialSet GetWifiCredentialsForProfileChromeOs( | 118 WifiCredentialSet GetWifiCredentialsForProfileChromeOs( |
| 119 const content::BrowserContext* browser_context) { | 119 const content::BrowserContext* browser_context) { |
| 120 DCHECK(browser_context); | 120 DCHECK(browser_context); |
| 121 return wifi_sync::GetWifiCredentialsForShillProfile( | 121 return sync_wifi::GetWifiCredentialsForShillProfile( |
| 122 GetNetworkStateHandler(), | 122 GetNetworkStateHandler(), |
| 123 ShillProfilePathForBrowserContext(*browser_context)); | 123 ShillProfilePathForBrowserContext(*browser_context)); |
| 124 } | 124 } |
| 125 | 125 |
| 126 } // namespace chromeos | 126 } // namespace chromeos |
| 127 | 127 |
| 128 } // namespace wifi_credentials_helper | 128 } // namespace wifi_credentials_helper |
| OLD | NEW |