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

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: rebase Created 5 years, 11 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
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(SingleClientWifiCredentialsSyncTest); 38 DISALLOW_COPY_AND_ASSIGN(SingleClientWifiCredentialsSyncTest);
23 }; 39 };
24 40
25 IN_PROC_BROWSER_TEST_F(SingleClientWifiCredentialsSyncTest, NoCredentials) { 41 IN_PROC_BROWSER_TEST_F(SingleClientWifiCredentialsSyncTest, 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::ProfileMatchesVerifier(0)); 44 ASSERT_TRUE(wifi_credentials_helper::ProfileMatchesVerifier(0));
29 } 45 }
46
47 IN_PROC_BROWSER_TEST_F(SingleClientWifiCredentialsSyncTest, SingleCredential) {
48 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
49 const size_t profile_index = 0;
50 wifi_credentials_helper::AddWifiCredential(
51 profile_index,
52 "fake_id",
53 wifi_credentials_helper::MakeWifiCredential(
54 "fake-ssid", wifi_sync::SECURITY_CLASS_PSK, "fake_passphrase"));
stevenjb 2015/01/28 21:29:43 I would call MakeWifiCredential separately and ass
mukesh agrawal 2015/01/28 22:55:11 Done.
55 ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0))));
56 ASSERT_FALSE(wifi_credentials_helper::VerifierIsEmpty());
57 ASSERT_TRUE(wifi_credentials_helper::ProfileMatchesVerifier(0));
stevenjb 2015/01/28 21:29:43 The last two could probably be EXPECT instead of a
mukesh agrawal 2015/01/28 22:55:11 Done.
58 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698