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 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_WIFI_CREDENTIALS_HELPER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_WIFI_CREDENTIALS_HELPER_H_ |
6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_WIFI_CREDENTIALS_HELPER_H_ | 6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_WIFI_CREDENTIALS_HELPER_H_ |
7 | 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/compiler_specific.h" |
| 11 #include "components/wifi_sync/wifi_security_class.h" |
| 12 |
| 13 namespace wifi_sync { |
| 14 class WifiCredential; |
| 15 } |
| 16 |
8 // Functions needed by multiple wifi_credentials integration | 17 // Functions needed by multiple wifi_credentials integration |
9 // tests. This module is platfrom-agnostic, and calls out to | 18 // tests. This module is platfrom-agnostic, and calls out to |
10 // platform-specific code as needed. | 19 // platform-specific code as needed. |
11 namespace wifi_credentials_helper { | 20 namespace wifi_credentials_helper { |
12 | 21 |
| 22 // Performs common setup steps, such as configuring factories. Should |
| 23 // be called before SyncTest::SetUp. |
| 24 void SetUp(); |
| 25 |
| 26 // Initializes the clients. This includes associating their Chrome |
| 27 // Profiles with platform-specific networking state. Should be called |
| 28 // before adding/removing/modifying WiFi credentials. |
| 29 bool SetupClients() WARN_UNUSED_RESULT; |
| 30 |
13 // Checks if the verifier has any items in it. Returns true iff the | 31 // Checks if the verifier has any items in it. Returns true iff the |
14 // verifier has no items. | 32 // verifier has no items. |
15 bool VerifierIsEmpty(); | 33 bool VerifierIsEmpty(); |
16 | 34 |
17 // Compares the BrowserContext for |profile_index| with the | 35 // Compares the BrowserContext for |profile_index| with the |
18 // verifier. Returns true iff their WiFi credentials match. | 36 // verifier. Returns true iff their WiFi credentials match. |
19 bool ProfileMatchesVerifier(int profile_index); | 37 bool ProfileMatchesVerifier(int profile_index); |
20 | 38 |
21 // Returns true iff all BrowserContexts match with the verifier. | 39 // Returns true iff all BrowserContexts match with the verifier. |
22 bool AllProfilesMatch(); | 40 bool AllProfilesMatch(); |
23 | 41 |
| 42 // Returns a new WifiCredential constructed from the given parameters. |
| 43 wifi_sync::WifiCredential MakeWifiCredential( |
| 44 const std::string& ssid, |
| 45 wifi_sync::WifiSecurityClass security_class, |
| 46 const std::string& passphrase); |
| 47 |
| 48 // Adds a WiFi credential to the service at index |profile_index|, |
| 49 // and the verifier (if the SyncTest uses a verifier). |
| 50 void AddWifiCredential(int profile_index, |
| 51 const std::string& sync_id, |
| 52 const wifi_sync::WifiCredential& credential); |
| 53 |
24 } // namespace wifi_credentials_helper | 54 } // namespace wifi_credentials_helper |
25 | 55 |
26 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_WIFI_CREDENTIALS_HELPER_H_ | 56 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_WIFI_CREDENTIALS_HELPER_H_ |
OLD | NEW |