| Index: chrome/browser/sync/test/integration/wifi_credentials_helper.cc
|
| diff --git a/chrome/browser/sync/test/integration/wifi_credentials_helper.cc b/chrome/browser/sync/test/integration/wifi_credentials_helper.cc
|
| index d29765f1cb848db10e2b51b8fe725d0b044b33e3..80918c39ae75ad99e9e6f68ada1ef6d6fdbf5b2b 100644
|
| --- a/chrome/browser/sync/test/integration/wifi_credentials_helper.cc
|
| +++ b/chrome/browser/sync/test/integration/wifi_credentials_helper.cc
|
| @@ -10,6 +10,8 @@
|
| #include "chrome/browser/sync/test/integration/sync_datatype_helper.h"
|
| #include "chrome/browser/sync/test/integration/sync_test.h"
|
| #include "components/wifi_sync/wifi_credential.h"
|
| +#include "components/wifi_sync/wifi_credential_syncable_service.h"
|
| +#include "components/wifi_sync/wifi_credential_syncable_service_factory.h"
|
| #include "components/wifi_sync/wifi_security_class.h"
|
|
|
| #if defined(OS_CHROMEOS)
|
| @@ -17,6 +19,8 @@
|
| #endif
|
|
|
| using wifi_sync::WifiCredential;
|
| +using wifi_sync::WifiCredentialSyncableService;
|
| +using wifi_sync::WifiCredentialSyncableServiceFactory;
|
| using sync_datatype_helper::test;
|
|
|
| using WifiCredentialSet = wifi_sync::WifiCredential::CredentialSet;
|
| @@ -24,6 +28,33 @@ using WifiCredentialSet = wifi_sync::WifiCredential::CredentialSet;
|
| namespace wifi_credentials_helper {
|
|
|
| namespace {
|
| +bool SetupClientForProfile(Profile* profile) {
|
| +#if defined(OS_CHROMEOS)
|
| + return SetupClientForProfileChromeOs(profile);
|
| +#else
|
| + NOTIMPLEMENTED();
|
| + return false;
|
| +#endif
|
| +}
|
| +
|
| +WifiCredentialSyncableService* GetServiceForBrowserContext(
|
| + content::BrowserContext* context) {
|
| + return WifiCredentialSyncableServiceFactory::GetForBrowserContext(
|
| + context);
|
| +}
|
| +
|
| +WifiCredentialSyncableService* GetServiceForProfile(int profile_index) {
|
| + return GetServiceForBrowserContext(test()->GetProfile(profile_index));
|
| +}
|
| +
|
| +void AddWifiCredentialToProfile(
|
| + Profile* profile, const WifiCredential& credential) {
|
| +#if defined(OS_CHROMEOS)
|
| + AddWifiCredentialToProfileChromeOs(profile, credential);
|
| +#else
|
| + NOTIMPLEMENTED();
|
| +#endif
|
| +}
|
|
|
| WifiCredentialSet GetWifiCredentialsForProfile(const Profile* profile) {
|
| #if defined(OS_CHROMEOS)
|
| @@ -61,6 +92,27 @@ bool CredentialsMatch(const WifiCredentialSet& a_credentials,
|
|
|
| } // namespace
|
|
|
| +void SetUp() {
|
| +#if defined(OS_CHROMEOS)
|
| + return SetUpChromeOs();
|
| +#else
|
| + NOTIMPLEMENTED();
|
| +#endif
|
| +}
|
| +
|
| +bool SetupClients() {
|
| + if (!SetupClientForProfile(test()->verifier())) {
|
| + return false;
|
| + }
|
| +
|
| + for (int i = 0; i < test()->num_clients(); ++i) {
|
| + if (!SetupClientForProfile(test()->GetProfile(i))) {
|
| + return false;
|
| + }
|
| + }
|
| + return true;
|
| +}
|
| +
|
| bool VerifierIsEmpty() {
|
| return GetWifiCredentialsForProfile(test()->verifier()).empty();
|
| }
|
| @@ -92,4 +144,18 @@ bool AllProfilesMatch() {
|
| return true;
|
| }
|
|
|
| +void AddWifiCredential(int profile_index,
|
| + const std::string& sync_id,
|
| + const WifiCredential& credential) {
|
| + AddWifiCredentialToProfile(test()->GetProfile(profile_index), credential);
|
| + if (test()->use_verifier())
|
| + AddWifiCredentialToProfile(test()->verifier(), credential);
|
| +
|
| + // TODO(quiche): Remove this, once we have plumbing to route
|
| + // NetworkConfigurationObserver events to
|
| + // WifiCredentialSyncableService instances.
|
| + GetServiceForProfile(profile_index)
|
| + ->AddToSyncedNetworks(sync_id, credential);
|
| +}
|
| +
|
| } // namespace wifi_credentials_helper
|
|
|