Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Unified Diff: chrome/browser/sync/test/integration/single_client_wifi_credentials_sync_test.cc

Issue 843483004: sync: add more integration tests for wifi_sync (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@submit-4.3-syncable-service
Patch Set: rebase, and resolve (trivial) conflict Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/test/integration/single_client_wifi_credentials_sync_test.cc
diff --git a/chrome/browser/sync/test/integration/single_client_wifi_credentials_sync_test.cc b/chrome/browser/sync/test/integration/single_client_wifi_credentials_sync_test.cc
index f8c68aa85ee5442ed0fc8d3004451227ee119b84..ab01c6f11888a2af493c50bed8a2bf6437c0c355 100644
--- a/chrome/browser/sync/test/integration/single_client_wifi_credentials_sync_test.cc
+++ b/chrome/browser/sync/test/integration/single_client_wifi_credentials_sync_test.cc
@@ -4,20 +4,41 @@
#include "base/command_line.h"
#include "base/macros.h"
+#include "chrome/browser/sync/test/integration/sync_integration_test_util.h"
#include "chrome/browser/sync/test/integration/sync_test.h"
#include "chrome/browser/sync/test/integration/wifi_credentials_helper.h"
#include "chrome/common/chrome_switches.h"
+#include "components/wifi_sync/wifi_credential.h"
+#include "components/wifi_sync/wifi_security_class.h"
+
+using sync_integration_test_util::AwaitCommitActivityCompletion;
+using wifi_sync::WifiCredential;
+
+using WifiCredentialSet = wifi_sync::WifiCredential::CredentialSet;
class SingleClientWifiCredentialsSyncTest : public SyncTest {
public:
SingleClientWifiCredentialsSyncTest() : SyncTest(SINGLE_CLIENT) {}
~SingleClientWifiCredentialsSyncTest() override {}
+ // SyncTest implementation.
+ void SetUp() override {
+ wifi_credentials_helper::SetUp();
+ SyncTest::SetUp();
+ }
+
void SetUpCommandLine(base::CommandLine* command_line) override {
SyncTest::SetUpCommandLine(command_line);
command_line->AppendSwitch(switches::kEnableWifiCredentialSync);
}
+ bool SetupClients() override {
+ if (!SyncTest::SetupClients())
+ return false;
+ wifi_credentials_helper::SetupClients();
+ return true;
+ }
+
private:
DISALLOW_COPY_AND_ASSIGN(SingleClientWifiCredentialsSyncTest);
};
@@ -27,3 +48,26 @@ IN_PROC_BROWSER_TEST_F(SingleClientWifiCredentialsSyncTest, NoCredentials) {
ASSERT_TRUE(wifi_credentials_helper::VerifierIsEmpty());
ASSERT_TRUE(wifi_credentials_helper::ProfileMatchesVerifier(0));
}
+
+IN_PROC_BROWSER_TEST_F(SingleClientWifiCredentialsSyncTest, SingleCredential) {
+ ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
+
+ const char ssid[] = "fake-ssid";
+ scoped_ptr<WifiCredential> credential =
+ wifi_credentials_helper::MakeWifiCredential(
+ ssid, wifi_sync::SECURITY_CLASS_PSK, "fake_passphrase");
+ ASSERT_TRUE(credential);
+
+ const size_t profile_index = 0;
+ wifi_credentials_helper::AddWifiCredential(
+ profile_index, "fake_id", *credential);
+
+ const WifiCredentialSet verifier_credentials =
+ wifi_credentials_helper::GetWifiCredentialsForProfile(verifier());
+ EXPECT_EQ(1U, verifier_credentials.size());
+ EXPECT_EQ(WifiCredential::MakeSsidBytesForTest(ssid),
+ verifier_credentials.begin()->ssid());
+
+ ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((profile_index))));
+ EXPECT_TRUE(wifi_credentials_helper::ProfileMatchesVerifier(profile_index));
+}

Powered by Google App Engine
This is Rietveld 408576698