| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 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/sync/test/integration/sync_test.h" | 9 #include "chrome/browser/sync/test/integration/sync_test.h" |
| 10 #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h
" | 10 #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h
" |
| 11 #include "chrome/browser/sync/test/integration/wifi_credentials_helper.h" | 11 #include "chrome/browser/sync/test/integration/wifi_credentials_helper.h" |
| 12 #include "chrome/common/chrome_switches.h" | 12 #include "chrome/common/chrome_switches.h" |
| 13 #include "components/browser_sync/browser_sync_switches.h" | 13 #include "components/browser_sync/browser_sync_switches.h" |
| 14 #include "components/wifi_sync/wifi_credential.h" | 14 #include "components/sync_wifi/wifi_credential.h" |
| 15 #include "components/wifi_sync/wifi_security_class.h" | 15 #include "components/sync_wifi/wifi_security_class.h" |
| 16 | 16 |
| 17 using wifi_sync::WifiCredential; | 17 using sync_wifi::WifiCredential; |
| 18 | 18 |
| 19 using WifiCredentialSet = wifi_sync::WifiCredential::CredentialSet; | 19 using WifiCredentialSet = sync_wifi::WifiCredential::CredentialSet; |
| 20 | 20 |
| 21 class SingleClientWifiCredentialsSyncTest : public SyncTest { | 21 class SingleClientWifiCredentialsSyncTest : public SyncTest { |
| 22 public: | 22 public: |
| 23 SingleClientWifiCredentialsSyncTest() : SyncTest(SINGLE_CLIENT) {} | 23 SingleClientWifiCredentialsSyncTest() : SyncTest(SINGLE_CLIENT) {} |
| 24 ~SingleClientWifiCredentialsSyncTest() override {} | 24 ~SingleClientWifiCredentialsSyncTest() override {} |
| 25 | 25 |
| 26 // SyncTest implementation. | 26 // SyncTest implementation. |
| 27 void SetUp() override { | 27 void SetUp() override { |
| 28 wifi_credentials_helper::SetUp(); | 28 wifi_credentials_helper::SetUp(); |
| 29 SyncTest::SetUp(); | 29 SyncTest::SetUp(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 50 ASSERT_TRUE(wifi_credentials_helper::VerifierIsEmpty()); | 50 ASSERT_TRUE(wifi_credentials_helper::VerifierIsEmpty()); |
| 51 ASSERT_TRUE(wifi_credentials_helper::ProfileMatchesVerifier(0)); | 51 ASSERT_TRUE(wifi_credentials_helper::ProfileMatchesVerifier(0)); |
| 52 } | 52 } |
| 53 | 53 |
| 54 IN_PROC_BROWSER_TEST_F(SingleClientWifiCredentialsSyncTest, SingleCredential) { | 54 IN_PROC_BROWSER_TEST_F(SingleClientWifiCredentialsSyncTest, SingleCredential) { |
| 55 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 55 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 56 | 56 |
| 57 const char ssid[] = "fake-ssid"; | 57 const char ssid[] = "fake-ssid"; |
| 58 std::unique_ptr<WifiCredential> credential = | 58 std::unique_ptr<WifiCredential> credential = |
| 59 wifi_credentials_helper::MakeWifiCredential( | 59 wifi_credentials_helper::MakeWifiCredential( |
| 60 ssid, wifi_sync::SECURITY_CLASS_PSK, "fake_passphrase"); | 60 ssid, sync_wifi::SECURITY_CLASS_PSK, "fake_passphrase"); |
| 61 ASSERT_TRUE(credential); | 61 ASSERT_TRUE(credential); |
| 62 | 62 |
| 63 const size_t profile_index = 0; | 63 const size_t profile_index = 0; |
| 64 wifi_credentials_helper::AddWifiCredential( | 64 wifi_credentials_helper::AddWifiCredential( |
| 65 profile_index, "fake_id", *credential); | 65 profile_index, "fake_id", *credential); |
| 66 | 66 |
| 67 const WifiCredentialSet verifier_credentials = | 67 const WifiCredentialSet verifier_credentials = |
| 68 wifi_credentials_helper::GetWifiCredentialsForProfile(verifier()); | 68 wifi_credentials_helper::GetWifiCredentialsForProfile(verifier()); |
| 69 EXPECT_EQ(1U, verifier_credentials.size()); | 69 EXPECT_EQ(1U, verifier_credentials.size()); |
| 70 EXPECT_EQ(WifiCredential::MakeSsidBytesForTest(ssid), | 70 EXPECT_EQ(WifiCredential::MakeSsidBytesForTest(ssid), |
| 71 verifier_credentials.begin()->ssid()); | 71 verifier_credentials.begin()->ssid()); |
| 72 | 72 |
| 73 ASSERT_TRUE( | 73 ASSERT_TRUE( |
| 74 UpdatedProgressMarkerChecker(GetSyncService(profile_index)).Wait()); | 74 UpdatedProgressMarkerChecker(GetSyncService(profile_index)).Wait()); |
| 75 EXPECT_TRUE(wifi_credentials_helper::ProfileMatchesVerifier(profile_index)); | 75 EXPECT_TRUE(wifi_credentials_helper::ProfileMatchesVerifier(profile_index)); |
| 76 } | 76 } |
| OLD | NEW |