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

Side by Side Diff: chrome/browser/sync/test/integration/single_client_printers_sync_test.cc

Issue 2799103002: Enable printers sync_integration_tests on chromeos (Closed)
Patch Set: update comments Created 3 years, 8 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "chrome/browser/sync/test/integration/printers_helper.h" 8 #include "chrome/browser/sync/test/integration/printers_helper.h"
9 #include "chrome/browser/sync/test/integration/sync_test.h" 9 #include "chrome/browser/sync/test/integration/sync_test.h"
10 #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h " 10 #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h "
11 #include "chromeos/printing/printer_configuration.h" 11 #include "chromeos/printing/printer_configuration.h"
12 12
13 using printers_helper::AddPrinter; 13 using printers_helper::AddPrinter;
14 using printers_helper::CreateTestPrinter; 14 using printers_helper::CreateTestPrinter;
15 using printers_helper::EditPrinterDescription; 15 using printers_helper::EditPrinterDescription;
16 using printers_helper::GetVerifierPrinterCount; 16 using printers_helper::GetVerifierPrinterCount;
17 using printers_helper::GetVerifierPrinterStore; 17 using printers_helper::GetVerifierPrinterStore;
18 using printers_helper::GetPrinterCount; 18 using printers_helper::GetPrinterCount;
19 using printers_helper::GetPrinterStore; 19 using printers_helper::GetPrinterStore;
20 using printers_helper::ProfileContainsSamePrintersAsVerifier; 20 using printers_helper::ProfileContainsSamePrintersAsVerifier;
21 using printers_helper::RemovePrinter; 21 using printers_helper::RemovePrinter;
22 22
23 class SingleClientPrintersSyncTest : public SyncTest { 23 class SingleClientPrintersSyncTest : public SyncTest {
24 public: 24 public:
25 SingleClientPrintersSyncTest() : SyncTest(SINGLE_CLIENT) {} 25 SingleClientPrintersSyncTest() : SyncTest(SINGLE_CLIENT) {}
26 ~SingleClientPrintersSyncTest() override {} 26 ~SingleClientPrintersSyncTest() override {}
27 27
28 bool SetupSync() override {
29 if (!SyncTest::SetupSync())
30 return false;
31
32 // Wait for sync to complete initialization before proceeding.
33 return UpdatedProgressMarkerChecker(GetSyncService(0)).Wait();
34 }
35
36 private: 28 private:
37 DISALLOW_COPY_AND_ASSIGN(SingleClientPrintersSyncTest); 29 DISALLOW_COPY_AND_ASSIGN(SingleClientPrintersSyncTest);
38 }; 30 };
39 31
40 // Verify that printers aren't added with a sync call. 32 // Verify that printers aren't added with a sync call.
41 IN_PROC_BROWSER_TEST_F(SingleClientPrintersSyncTest, NoPrinters) { 33 IN_PROC_BROWSER_TEST_F(SingleClientPrintersSyncTest, NoPrinters) {
42 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 34 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
35 // TODO(sync): Should not use UpdatedProgressMarkerChecker here since
36 // UpdatedProgressMarkerChecker is for SyncableService datatype, but
37 // syncer::PRINTERS is ModelTypeSyncBridge datatype. So maybe we should create
38 // another checker for ModelTypeSyncBridge, or some other things to wait for
39 // ModelTypeSyncBridge datatype.
40 ASSERT_TRUE(UpdatedProgressMarkerChecker(GetSyncService(0)).Wait());
43 EXPECT_TRUE(ProfileContainsSamePrintersAsVerifier(0)); 41 EXPECT_TRUE(ProfileContainsSamePrintersAsVerifier(0));
44 } 42 }
45 43
46 // Verify syncing doesn't randomly remove a printer. 44 // Verify syncing doesn't randomly remove a printer.
47 IN_PROC_BROWSER_TEST_F(SingleClientPrintersSyncTest, SingleNewPrinter) { 45 IN_PROC_BROWSER_TEST_F(SingleClientPrintersSyncTest, SingleNewPrinter) {
48 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 46 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
49 47
50 ASSERT_EQ(0, GetVerifierPrinterCount()); 48 ASSERT_EQ(0, GetVerifierPrinterCount());
51 49
52 AddPrinter(GetPrinterStore(0), printers_helper::CreateTestPrinter(0)); 50 AddPrinter(GetPrinterStore(0), printers_helper::CreateTestPrinter(0));
53 AddPrinter(GetVerifierPrinterStore(), printers_helper::CreateTestPrinter(0)); 51 AddPrinter(GetVerifierPrinterStore(), printers_helper::CreateTestPrinter(0));
54 ASSERT_EQ(1, GetPrinterCount(0)); 52 ASSERT_EQ(1, GetPrinterCount(0));
55 ASSERT_EQ(1, GetVerifierPrinterCount()); 53 ASSERT_EQ(1, GetVerifierPrinterCount());
56 54
57 ASSERT_TRUE(UpdatedProgressMarkerChecker(GetSyncService(0)).Wait()); 55 ASSERT_TRUE(UpdatedProgressMarkerChecker(GetSyncService(0)).Wait());
58 EXPECT_EQ(1, GetVerifierPrinterCount()); 56 EXPECT_EQ(1, GetVerifierPrinterCount());
59 EXPECT_TRUE(ProfileContainsSamePrintersAsVerifier(0)); 57 EXPECT_TRUE(ProfileContainsSamePrintersAsVerifier(0));
60 } 58 }
61 59
62 // Verify editing a printer doesn't add it. 60 // Verify editing a printer doesn't add it.
63 // Flaky on ChromeOS. http://crbug.com/701999 61 IN_PROC_BROWSER_TEST_F(SingleClientPrintersSyncTest, EditPrinter) {
64 #if defined(OS_CHROMEOS)
65 #define MAYBE_EditPrinter DISABLED_EditPrinter
66 #else
67 #define MAYBE_EditPrinter EditPrinter
68 #endif
69 IN_PROC_BROWSER_TEST_F(SingleClientPrintersSyncTest, MAYBE_EditPrinter) {
70 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 62 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
71 63
72 AddPrinter(GetPrinterStore(0), printers_helper::CreateTestPrinter(0)); 64 AddPrinter(GetPrinterStore(0), printers_helper::CreateTestPrinter(0));
73 AddPrinter(GetVerifierPrinterStore(), printers_helper::CreateTestPrinter(0)); 65 AddPrinter(GetVerifierPrinterStore(), printers_helper::CreateTestPrinter(0));
74 66
75 ASSERT_TRUE( 67 ASSERT_TRUE(
76 EditPrinterDescription(GetPrinterStore(0), 0, "Updated description")); 68 EditPrinterDescription(GetPrinterStore(0), 0, "Updated description"));
77 69
78 EXPECT_EQ(1, GetPrinterCount(0)); 70 EXPECT_EQ(1, GetPrinterCount(0));
79 EXPECT_EQ(1, GetVerifierPrinterCount()); 71 EXPECT_EQ(1, GetVerifierPrinterCount());
80 EXPECT_FALSE(ProfileContainsSamePrintersAsVerifier(0)); 72 EXPECT_FALSE(ProfileContainsSamePrintersAsVerifier(0));
81 } 73 }
82 74
83 // Verify that removing a printer works. 75 // Verify that removing a printer works.
84 IN_PROC_BROWSER_TEST_F(SingleClientPrintersSyncTest, RemovePrinter) { 76 IN_PROC_BROWSER_TEST_F(SingleClientPrintersSyncTest, RemovePrinter) {
85 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 77 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
86 78
87 AddPrinter(GetPrinterStore(0), printers_helper::CreateTestPrinter(0)); 79 AddPrinter(GetPrinterStore(0), printers_helper::CreateTestPrinter(0));
88 EXPECT_EQ(1, GetPrinterCount(0)); 80 EXPECT_EQ(1, GetPrinterCount(0));
89 81
90 RemovePrinter(GetPrinterStore(0), 0); 82 RemovePrinter(GetPrinterStore(0), 0);
91 EXPECT_EQ(0, GetPrinterCount(0)); 83 EXPECT_EQ(0, GetPrinterCount(0));
92 } 84 }
93 85
94 // Verify that merging data added before sync works. 86 // Verify that merging data added before sync works.
95 // crbug.com/689662 87 IN_PROC_BROWSER_TEST_F(SingleClientPrintersSyncTest, AddBeforeSetup) {
96 #if defined(OS_CHROMEOS)
97 #define MAYBE_AddBeforeSetup DISABLED_AddBeforeSetup
98 #else
99 #define MAYBE_AddBeforeSetup AddBeforeSetup
100 #endif
101 IN_PROC_BROWSER_TEST_F(SingleClientPrintersSyncTest, MAYBE_AddBeforeSetup) {
102 ASSERT_TRUE(SetupClients()); 88 ASSERT_TRUE(SetupClients());
103 89
104 AddPrinter(GetPrinterStore(0), printers_helper::CreateTestPrinter(0)); 90 AddPrinter(GetPrinterStore(0), printers_helper::CreateTestPrinter(0));
105 EXPECT_EQ(1, GetPrinterCount(0)); 91 EXPECT_EQ(1, GetPrinterCount(0));
106 92
107 EXPECT_TRUE(SetupSync()) << "SetupSync() failed."; 93 EXPECT_TRUE(SetupSync()) << "SetupSync() failed.";
108 } 94 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698