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

Side by Side 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: address feedback from pneubeck, on PS6 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 unified diff | Download patch
OLDNEW
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/sync_integration_test_util.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 sync_integration_test_util::AwaitCommitActivityCompletion;
15 using wifi_sync::WifiCredential;
10 16
11 class SingleClientWifiCredentialsSyncTest : public SyncTest { 17 class SingleClientWifiCredentialsSyncTest : public SyncTest {
12 public: 18 public:
13 SingleClientWifiCredentialsSyncTest() : SyncTest(SINGLE_CLIENT) {} 19 SingleClientWifiCredentialsSyncTest() : SyncTest(SINGLE_CLIENT) {}
14 ~SingleClientWifiCredentialsSyncTest() override {} 20 ~SingleClientWifiCredentialsSyncTest() override {}
15 21
22 // SyncTest implementation.
23 void SetUp() override {
24 wifi_credentials_helper::SetUp();
25 SyncTest::SetUp();
26 }
27
16 void SetUpCommandLine(base::CommandLine* command_line) override { 28 void SetUpCommandLine(base::CommandLine* command_line) override {
17 SyncTest::SetUpCommandLine(command_line); 29 SyncTest::SetUpCommandLine(command_line);
18 command_line->AppendSwitch(switches::kEnableWifiCredentialSync); 30 command_line->AppendSwitch(switches::kEnableWifiCredentialSync);
19 } 31 }
20 32
33 bool SetupClients() override {
34 return SyncTest::SetupClients() &&
35 wifi_credentials_helper::SetupClients();
36 }
37
21 private: 38 private:
22 DISALLOW_COPY_AND_ASSIGN(SingleClientWifiCredentialsSyncTest); 39 DISALLOW_COPY_AND_ASSIGN(SingleClientWifiCredentialsSyncTest);
23 }; 40 };
24 41
25 IN_PROC_BROWSER_TEST_F(SingleClientWifiCredentialsSyncTest, NoCredentials) { 42 IN_PROC_BROWSER_TEST_F(SingleClientWifiCredentialsSyncTest, NoCredentials) {
26 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 43 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
27 ASSERT_TRUE(wifi_credentials_helper::VerifierIsEmpty()); 44 ASSERT_TRUE(wifi_credentials_helper::VerifierIsEmpty());
28 ASSERT_TRUE(wifi_credentials_helper::ProfileMatchesVerifier(0)); 45 ASSERT_TRUE(wifi_credentials_helper::ProfileMatchesVerifier(0));
29 } 46 }
47
48 IN_PROC_BROWSER_TEST_F(SingleClientWifiCredentialsSyncTest, SingleCredential) {
49 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
50
51 scoped_ptr<WifiCredential> credential =
52 wifi_credentials_helper::MakeWifiCredential(
53 "fake-ssid", wifi_sync::SECURITY_CLASS_PSK, "fake_passphrase");
54 ASSERT_TRUE(credential);
55
56 const size_t profile_index = 0;
57 wifi_credentials_helper::AddWifiCredential(
58 profile_index, "fake_id", *credential);
59 ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0))));
60 EXPECT_FALSE(wifi_credentials_helper::VerifierIsEmpty());
61 EXPECT_TRUE(wifi_credentials_helper::ProfileMatchesVerifier(0));
62 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698