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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/macros.h" | 6 #include "base/macros.h" |
7 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" | |
7 #include "chrome/browser/sync/test/integration/sync_test.h" | 8 #include "chrome/browser/sync/test/integration/sync_test.h" |
8 #include "chrome/browser/sync/test/integration/wifi_credentials_helper.h" | 9 #include "chrome/browser/sync/test/integration/wifi_credentials_helper.h" |
9 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
11 #include "components/wifi_sync/wifi_credential.h" | |
12 #include "components/wifi_sync/wifi_security_class.h" | |
13 | |
14 using wifi_sync::WifiCredential; | |
15 using SsidBytes = wifi_sync::WifiCredential::SsidBytes; | |
10 | 16 |
11 class TwoClientWifiCredentialsSyncTest : public SyncTest { | 17 class TwoClientWifiCredentialsSyncTest : public SyncTest { |
12 public: | 18 public: |
13 TwoClientWifiCredentialsSyncTest() : SyncTest(TWO_CLIENT) {} | 19 TwoClientWifiCredentialsSyncTest() : SyncTest(TWO_CLIENT) {} |
14 ~TwoClientWifiCredentialsSyncTest() override {} | 20 ~TwoClientWifiCredentialsSyncTest() override {} |
15 | 21 |
stevenjb
2015/01/28 21:29:43
// SyncTest
mukesh agrawal
2015/01/28 22:55:11
Done.
| |
22 void SetUp() override { | |
23 wifi_credentials_helper::SetUp(); | |
24 SyncTest::SetUp(); | |
25 } | |
26 | |
16 void SetUpCommandLine(base::CommandLine* command_line) override { | 27 void SetUpCommandLine(base::CommandLine* command_line) override { |
17 SyncTest::SetUpCommandLine(command_line); | 28 SyncTest::SetUpCommandLine(command_line); |
18 command_line->AppendSwitch(switches::kEnableWifiCredentialSync); | 29 command_line->AppendSwitch(switches::kEnableWifiCredentialSync); |
19 } | 30 } |
20 | 31 |
32 bool SetupClients() override { | |
33 return SyncTest::SetupClients() && | |
34 wifi_credentials_helper::SetupClients(); | |
35 } | |
36 | |
21 private: | 37 private: |
22 DISALLOW_COPY_AND_ASSIGN(TwoClientWifiCredentialsSyncTest); | 38 DISALLOW_COPY_AND_ASSIGN(TwoClientWifiCredentialsSyncTest); |
23 }; | 39 }; |
24 | 40 |
25 IN_PROC_BROWSER_TEST_F(TwoClientWifiCredentialsSyncTest, NoCredentials) { | 41 IN_PROC_BROWSER_TEST_F(TwoClientWifiCredentialsSyncTest, NoCredentials) { |
26 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 42 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
27 ASSERT_TRUE(wifi_credentials_helper::VerifierIsEmpty()); | 43 ASSERT_TRUE(wifi_credentials_helper::VerifierIsEmpty()); |
28 ASSERT_TRUE(wifi_credentials_helper::AllProfilesMatch()); | 44 ASSERT_TRUE(wifi_credentials_helper::AllProfilesMatch()); |
29 } | 45 } |
46 | |
47 IN_PROC_BROWSER_TEST_F(TwoClientWifiCredentialsSyncTest, SingleCredential) { | |
48 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | |
49 const size_t profile_a_index = 0; | |
50 const size_t profile_b_index = 1; | |
51 wifi_credentials_helper::AddWifiCredential( | |
52 profile_a_index, | |
53 "fake_id", | |
54 wifi_credentials_helper::MakeWifiCredential( | |
55 "fake-ssid", wifi_sync::SECURITY_CLASS_PSK, "fake_passphrase")); | |
56 ASSERT_TRUE(GetClient(profile_a_index)->AwaitMutualSyncCycleCompletion( | |
57 GetClient(profile_b_index))); | |
58 ASSERT_FALSE(wifi_credentials_helper::VerifierIsEmpty()); | |
59 ASSERT_TRUE(wifi_credentials_helper::AllProfilesMatch()); | |
stevenjb
2015/01/28 21:29:43
EXPECT?
mukesh agrawal
2015/01/28 22:55:11
Done.
| |
60 } | |
OLD | NEW |