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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_WIFI_CREDENTIALS_HELPER_H_
6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_WIFI_CREDENTIALS_HELPER_H_
10 #include "base/memory/scoped_ptr.h"
11 #include "components/wifi_sync/wifi_credential.h"
12 #include "components/wifi_sync/wifi_security_class.h"
16 // Functions needed by multiple wifi_credentials integration
17 // tests. This module is platfrom-agnostic, and calls out to
18 // platform-specific code as needed.
19 namespace wifi_credentials_helper
{
21 // Performs common setup steps, such as configuring factories. Should
22 // be called before SyncTest::SetUp.
25 // Initializes the clients. This includes associating their Chrome
26 // Profiles with platform-specific networking state. Should be called
27 // before adding/removing/modifying WiFi credentials.
30 // Checks if the verifier has any items in it. Returns true iff the
31 // verifier has no items.
32 bool VerifierIsEmpty();
34 // Compares the BrowserContext for |profile_index| with the
35 // verifier. Returns true iff their WiFi credentials match.
36 bool ProfileMatchesVerifier(int profile_index
);
38 // Returns true iff all BrowserContexts match with the verifier.
39 bool AllProfilesMatch();
41 // Returns a new WifiCredential constructed from the given parameters.
42 scoped_ptr
<wifi_sync::WifiCredential
> MakeWifiCredential(
43 const std::string
& ssid
,
44 wifi_sync::WifiSecurityClass security_class
,
45 const std::string
& passphrase
);
47 // Adds a WiFi credential to the service at index |profile_index|,
48 // and the verifier (if the SyncTest uses a verifier).
49 void AddWifiCredential(int profile_index
,
50 const std::string
& sync_id
,
51 const wifi_sync::WifiCredential
& credential
);
53 // Returns the set of WifiCredentials configured in local network
54 // settings, for |profile|.
55 wifi_sync::WifiCredential::CredentialSet
GetWifiCredentialsForProfile(
56 const Profile
* profile
);
58 } // namespace wifi_credentials_helper
60 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_WIFI_CREDENTIALS_HELPER_H_