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

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

Issue 2379433002: [Sync] Refactoring of sync integration test checkers to remove boilerplate await methods. (Closed)
Patch Set: Rebase Created 4 years, 2 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/two_client_dictionary_sync_test.cc
diff --git a/chrome/browser/sync/test/integration/two_client_dictionary_sync_test.cc b/chrome/browser/sync/test/integration/two_client_dictionary_sync_test.cc
index 84e9e5b6ff7ce20a123a3ca7f9838d6301c375d8..b9b36856ace0d9b5bd18193d2c9e9eb741204efd 100644
--- a/chrome/browser/sync/test/integration/two_client_dictionary_sync_test.cc
+++ b/chrome/browser/sync/test/integration/two_client_dictionary_sync_test.cc
@@ -8,13 +8,11 @@
#include "chrome/browser/sync/test/integration/profile_sync_service_harness.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/updated_progress_marker_checker.h"
#include "components/spellcheck/common/spellcheck_common.h"
#include "components/sync/base/model_type.h"
using spellcheck::MAX_SYNCABLE_DICTIONARY_WORDS;
-using dictionary_helper::AwaitNumDictionaryEntries;
-using sync_integration_test_util::AwaitCommitActivityCompletion;
-using sync_integration_test_util::AwaitServerCount;
class TwoClientDictionarySyncTest : public SyncTest {
public:
@@ -30,7 +28,7 @@ class TwoClientDictionarySyncTest : public SyncTest {
IN_PROC_BROWSER_TEST_F(TwoClientDictionarySyncTest, E2E_ENABLED(Sanity)) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
dictionary_helper::LoadDictionaries();
- ASSERT_TRUE(dictionary_helper::AwaitDictionariesMatch());
+ ASSERT_TRUE(DictionaryMatchChecker().Wait());
std::vector<std::string> words;
words.push_back("foo");
@@ -40,19 +38,19 @@ IN_PROC_BROWSER_TEST_F(TwoClientDictionarySyncTest, E2E_ENABLED(Sanity)) {
for (int i = 0; i < num_clients(); ++i) {
ASSERT_TRUE(dictionary_helper::AddWord(i, words[i]));
}
- ASSERT_TRUE(dictionary_helper::AwaitDictionariesMatch());
+ ASSERT_TRUE(DictionaryMatchChecker().Wait());
ASSERT_EQ(words.size(), dictionary_helper::GetDictionarySize(0));
for (int i = 0; i < num_clients(); ++i) {
ASSERT_TRUE(dictionary_helper::RemoveWord(i, words[i]));
}
- ASSERT_TRUE(dictionary_helper::AwaitDictionariesMatch());
+ ASSERT_TRUE(DictionaryMatchChecker().Wait());
ASSERT_EQ(0UL, dictionary_helper::GetDictionarySize(0));
DisableVerifier();
for (int i = 0; i < num_clients(); ++i)
ASSERT_TRUE(dictionary_helper::AddWord(i, words[i]));
- ASSERT_TRUE(dictionary_helper::AwaitDictionariesMatch());
+ ASSERT_TRUE(DictionaryMatchChecker().Wait());
ASSERT_EQ(words.size(), dictionary_helper::GetDictionarySize(0));
}
@@ -60,11 +58,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientDictionarySyncTest,
E2E_ENABLED(SimultaneousAdd)) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
dictionary_helper::LoadDictionaries();
- ASSERT_TRUE(dictionary_helper::AwaitDictionariesMatch());
+ ASSERT_TRUE(DictionaryMatchChecker().Wait());
for (int i = 0; i < num_clients(); ++i)
dictionary_helper::AddWord(i, "foo");
- ASSERT_TRUE(dictionary_helper::AwaitDictionariesMatch());
+ ASSERT_TRUE(DictionaryMatchChecker().Wait());
ASSERT_EQ(1UL, dictionary_helper::GetDictionarySize(0));
}
@@ -72,16 +70,16 @@ IN_PROC_BROWSER_TEST_F(TwoClientDictionarySyncTest,
E2E_ENABLED(SimultaneousRemove)) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
dictionary_helper::LoadDictionaries();
- ASSERT_TRUE(dictionary_helper::AwaitDictionariesMatch());
+ ASSERT_TRUE(DictionaryMatchChecker().Wait());
for (int i = 0; i < num_clients(); ++i)
dictionary_helper::AddWord(i, "foo");
- ASSERT_TRUE(dictionary_helper::AwaitDictionariesMatch());
+ ASSERT_TRUE(DictionaryMatchChecker().Wait());
ASSERT_EQ(1UL, dictionary_helper::GetDictionarySize(0));
for (int i = 0; i < num_clients(); ++i)
dictionary_helper::RemoveWord(i, "foo");
- ASSERT_TRUE(dictionary_helper::AwaitDictionariesMatch());
+ ASSERT_TRUE(DictionaryMatchChecker().Wait());
ASSERT_EQ(0UL, dictionary_helper::GetDictionarySize(0));
}
@@ -89,12 +87,12 @@ IN_PROC_BROWSER_TEST_F(TwoClientDictionarySyncTest,
E2E_ENABLED(AddDifferentToEach)) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
dictionary_helper::LoadDictionaries();
- ASSERT_TRUE(dictionary_helper::AwaitDictionariesMatch());
+ ASSERT_TRUE(DictionaryMatchChecker().Wait());
for (int i = 0; i < num_clients(); ++i)
dictionary_helper::AddWord(i, "foo" + base::IntToString(i));
- ASSERT_TRUE(dictionary_helper::AwaitDictionariesMatch());
+ ASSERT_TRUE(DictionaryMatchChecker().Wait());
ASSERT_EQ(num_clients(),
static_cast<int>(dictionary_helper::GetDictionarySize(0)));
}
@@ -103,18 +101,18 @@ IN_PROC_BROWSER_TEST_F(TwoClientDictionarySyncTest,
E2E_ENABLED(RemoveOnAAddOnB)) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
dictionary_helper::LoadDictionaries();
- ASSERT_TRUE(dictionary_helper::AwaitDictionariesMatch());
+ ASSERT_TRUE(DictionaryMatchChecker().Wait());
std::string word = "foo";
// Add on client A, check it appears on B.
ASSERT_TRUE(dictionary_helper::AddWord(0, word));
- ASSERT_TRUE(dictionary_helper::AwaitDictionariesMatch());
+ ASSERT_TRUE(DictionaryMatchChecker().Wait());
// Remove on client A, check it disappears on B.
ASSERT_TRUE(dictionary_helper::RemoveWord(0, word));
- ASSERT_TRUE(dictionary_helper::AwaitDictionariesMatch());
+ ASSERT_TRUE(DictionaryMatchChecker().Wait());
// Add on client B, check it appears on A.
ASSERT_TRUE(dictionary_helper::AddWord(1, word));
- ASSERT_TRUE(dictionary_helper::AwaitDictionariesMatch());
+ ASSERT_TRUE(DictionaryMatchChecker().Wait());
ASSERT_EQ(1UL, dictionary_helper::GetDictionarySize(0));
}
@@ -123,7 +121,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientDictionarySyncTest,
IN_PROC_BROWSER_TEST_F(TwoClientDictionarySyncTest, Limit) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
dictionary_helper::LoadDictionaries();
- ASSERT_TRUE(dictionary_helper::AwaitDictionariesMatch());
+ ASSERT_TRUE(DictionaryMatchChecker().Wait());
// Disable client #1 before client #0 starts adding anything.
GetClient(1)->DisableSyncForAllDatatypes();
@@ -146,7 +144,8 @@ IN_PROC_BROWSER_TEST_F(TwoClientDictionarySyncTest, Limit) {
// out. In there real world there's a race condition here, if multiple clients
// are adding words simultaneously then we're go over the limit slightly,
// though we'd expect this to be relatively small.
- AwaitServerCount(syncer::DICTIONARY, chunk_size);
+ ASSERT_TRUE(
+ ServerCountMatchStatusChecker(syncer::DICTIONARY, chunk_size).Wait());
ASSERT_TRUE(dictionary_helper::AddWords(1, 2 * chunk_size, "foo-1-"));
ASSERT_EQ(2 * chunk_size, dictionary_helper::GetDictionarySize(1));
@@ -156,8 +155,10 @@ IN_PROC_BROWSER_TEST_F(TwoClientDictionarySyncTest, Limit) {
// client #1 then tries to commit changes, that is when it obeys the limit
// and will cause client #0 to only see the limit worth of words.
ASSERT_TRUE(GetClient(1)->EnableSyncForAllDatatypes());
- ASSERT_TRUE(AwaitNumDictionaryEntries(1, 3 * chunk_size));
+ ASSERT_TRUE(NumDictionaryEntriesChecker(1, 3 * chunk_size).Wait());
+ ASSERT_TRUE(ServerCountMatchStatusChecker(syncer::DICTIONARY,
+ MAX_SYNCABLE_DICTIONARY_WORDS)
+ .Wait());
ASSERT_TRUE(
- AwaitServerCount(syncer::DICTIONARY, MAX_SYNCABLE_DICTIONARY_WORDS));
- ASSERT_TRUE(AwaitNumDictionaryEntries(0, MAX_SYNCABLE_DICTIONARY_WORDS));
+ NumDictionaryEntriesChecker(0, MAX_SYNCABLE_DICTIONARY_WORDS).Wait());
}

Powered by Google App Engine
This is Rietveld 408576698