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

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: use directory-level deps (instead of file-level) 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 }
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 }
31 bool SetupClients() override {
32 return SyncTest::SetupClients() &&
33 wifi_credentials_helper::SetupClients();
34 }
20 35
21 private: 36 private:
22 DISALLOW_COPY_AND_ASSIGN(SingleClientWifiCredentialsSyncTest); 37 DISALLOW_COPY_AND_ASSIGN(SingleClientWifiCredentialsSyncTest);
23 }; 38 };
24 39
25 IN_PROC_BROWSER_TEST_F(SingleClientWifiCredentialsSyncTest, NoCredentials) { 40 IN_PROC_BROWSER_TEST_F(SingleClientWifiCredentialsSyncTest, NoCredentials) {
26 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 41 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
27 ASSERT_TRUE(wifi_credentials_helper::VerifierIsEmpty()); 42 ASSERT_TRUE(wifi_credentials_helper::VerifierIsEmpty());
28 ASSERT_TRUE(wifi_credentials_helper::ProfileMatchesVerifier(0)); 43 ASSERT_TRUE(wifi_credentials_helper::ProfileMatchesVerifier(0));
29 } 44 }
45
46 IN_PROC_BROWSER_TEST_F(SingleClientWifiCredentialsSyncTest, SingleCredential) {
pneubeck (no reviews) 2015/01/30 14:38:45 is there a reason why this is a browser test but t
mukesh agrawal 2015/01/30 22:28:14 Just following the convention in this part of the
47 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
48
49 scoped_ptr<WifiCredential> credential =
50 wifi_credentials_helper::MakeWifiCredential(
51 "fake-ssid", wifi_sync::SECURITY_CLASS_PSK, "fake_passphrase");
52 ASSERT_TRUE(credential);
53
54 const size_t profile_index = 0;
55 wifi_credentials_helper::AddWifiCredential(
56 profile_index, "fake_id", *credential);
57 ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0))));
58 EXPECT_FALSE(wifi_credentials_helper::VerifierIsEmpty());
59 EXPECT_TRUE(wifi_credentials_helper::ProfileMatchesVerifier(0));
pneubeck (no reviews) 2015/01/30 14:38:45 to not rely on some function that compares all pro
mukesh agrawal 2015/01/30 22:28:14 I could, but that would diverge from the conventio
pneubeck (no reviews) 2015/01/31 10:26:40 my point was more about what you're comparing with
mukesh agrawal 2015/02/02 20:36:40 AIUI, the verifier is actually an important part o
60 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698