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

Issue 7259005: Allow sync integration tests to operate on multiple datatypes: Preferences + Bookmarks (Closed)

Created:
9 years, 6 months ago by Raghu Simha
Modified:
9 years, 4 months ago
CC:
chromium-reviews, ncarter (slow), idana, Paweł Hajdan Jr., braffert
Visibility:
Public.

Description

Allow sync integration tests to operate on multiple datatypes: Preferences + Bookmarks The sync integration tests currently use a class hierarchy where the test classes for each datatype are subclasses of LiveSyncTest. While this design worked in the past, it allows tests to work with only one datatype at a time, and therefore doesn't allow us to test the interplay between datatypes. This patch is the first in a series of patches that will move away from an inheritance model to one where test cases can operate on more than one datatype. It updates the Preferences and Bookmarks datatypes to the new model, and contains the following changes: - LivePreferencesSyncTest no longer inherits from LiveSyncTest, but is renamed to PreferencesHelper, and contains a bunch of static methods that perform various operations related to preferences. Similarly, LiveBookmarksSyncTest becomes BookmarksHelper. - SingleClientLivePreferencesSyncTest is renamed to SingleClientPreferencesSyncTest, and is a subclass of LiveSyncTest. It uses the methods in PreferencesHelper by including its header file and attaching itself to the helper. Similarly, SingleClientBookmarksSyncTest uses the methods in BookmarksHelper. - The old helper class BookmarkModelVerifier is now refactored into BookmarksHelper. This eliminates a bunch of wrapper methods that were in LiveBookmarksSyncTest. - Once more datatype helper classes are refactored out, tests can attach to more than one datatype helper and use all their methods. For example, the class MigrationErrorsTest benefits from this model by being able to use PreferencesHelper and BookmarksHelper. BUG=88510 TEST=sync_integration_tests, sync_performance_tests Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=94437

Patch Set 1 : Review this patch set for easy-to-review diffs. #

Patch Set 2 : Actual patch set. (Moves show up as adds / deletes. Hard to review) #

Total comments: 5

Patch Set 3 : Add BookmarksHelper class. (TODO: Trim lines to 80 chars) #

Patch Set 4 : Working version, ready for final review. #

Patch Set 5 : Rebase #

Total comments: 6

Patch Set 6 : Rebase (no code changes) #

Unified diffs Side-by-side diffs Delta from patch set Stats (+4065 lines, -4053 lines) Patch
M chrome/chrome_tests.gypi View 1 2 3 4 5 4 chunks +18 lines, -18 lines 0 comments Download
D chrome/test/live_sync/bookmark_model_verifier.h View 1 2 1 chunk +0 lines, -146 lines 0 comments Download
D chrome/test/live_sync/bookmark_model_verifier.cc View 1 2 3 4 1 chunk +0 lines, -388 lines 0 comments Download
A chrome/test/live_sync/bookmarks_helper.h View 1 2 3 1 chunk +242 lines, -0 lines 0 comments Download
A chrome/test/live_sync/bookmarks_helper.cc View 1 2 3 4 1 chunk +633 lines, -0 lines 0 comments Download
D chrome/test/live_sync/live_bookmarks_sync_test.h View 1 2 1 chunk +0 lines, -234 lines 0 comments Download
D chrome/test/live_sync/live_bookmarks_sync_test.cc View 1 2 3 4 1 chunk +0 lines, -295 lines 0 comments Download
M chrome/test/live_sync/live_preferences_sync_test.cc View 1 1 chunk +0 lines, -211 lines 0 comments Download
M chrome/test/live_sync/live_sync_test.h View 1 2 2 chunks +12 lines, -0 lines 0 comments Download
M chrome/test/live_sync/live_sync_test.cc View 1 2 3 4 4 chunks +10 lines, -0 lines 0 comments Download
A chrome/test/live_sync/many_client_bookmarks_sync_test.cc View 1 2 3 1 chunk +26 lines, -0 lines 0 comments Download
D chrome/test/live_sync/many_client_live_bookmarks_sync_test.cc View 1 2 1 chunk +0 lines, -15 lines 0 comments Download
M chrome/test/live_sync/many_client_live_preferences_sync_test.cc View 1 1 chunk +0 lines, -16 lines 0 comments Download
A chrome/test/live_sync/many_client_preferences_sync_test.cc View 1 2 1 chunk +28 lines, -0 lines 0 comments Download
M chrome/test/live_sync/migration_errors_test.cc View 1 2 3 4 7 chunks +58 lines, -139 lines 0 comments Download
A chrome/test/live_sync/multiple_client_bookmarks_sync_test.cc View 1 2 3 4 5 1 chunk +29 lines, -0 lines 0 comments Download
D chrome/test/live_sync/multiple_client_live_bookmarks_sync_test.cc View 1 2 1 chunk +0 lines, -19 lines 0 comments Download
M chrome/test/live_sync/multiple_client_live_preferences_sync_test.cc View 1 1 chunk +0 lines, -23 lines 0 comments Download
A chrome/test/live_sync/multiple_client_preferences_sync_test.cc View 1 2 1 chunk +34 lines, -0 lines 0 comments Download
M chrome/test/live_sync/performance/bookmarks_sync_perf_test.cc View 1 2 3 4 5 8 chunks +37 lines, -26 lines 0 comments Download
A chrome/test/live_sync/preferences_helper.h View 1 2 1 chunk +117 lines, -0 lines 0 comments Download
A + chrome/test/live_sync/preferences_helper.cc View 1 2 3 chunks +81 lines, -69 lines 0 comments Download
A chrome/test/live_sync/single_client_bookmarks_sync_test.cc View 1 2 3 1 chunk +145 lines, -0 lines 0 comments Download
D chrome/test/live_sync/single_client_live_bookmarks_sync_test.cc View 1 2 1 chunk +0 lines, -129 lines 0 comments Download
M chrome/test/live_sync/single_client_live_preferences_sync_test.cc View 1 1 chunk +0 lines, -16 lines 0 comments Download
A chrome/test/live_sync/single_client_preferences_sync_test.cc View 1 2 1 chunk +28 lines, -0 lines 0 comments Download
A chrome/test/live_sync/sync_datatype_helper.h View 1 2 1 chunk +34 lines, -0 lines 0 comments Download
A chrome/test/live_sync/sync_datatype_helper.cc View 1 2 1 chunk +27 lines, -0 lines 0 comments Download
A chrome/test/live_sync/two_client_bookmarks_sync_test.cc View 1 2 3 4 1 chunk +1848 lines, -0 lines 0 comments Download
D chrome/test/live_sync/two_client_live_bookmarks_sync_test.cc View 1 2 3 4 1 chunk +0 lines, -1717 lines 0 comments Download
M chrome/test/live_sync/two_client_live_preferences_sync_test.cc View 1 1 chunk +0 lines, -592 lines 0 comments Download
A chrome/test/live_sync/two_client_preferences_sync_test.cc View 1 2 1 chunk +658 lines, -0 lines 0 comments Download

Messages

Total messages: 13 (0 generated)
Raghu Simha
Tim/Nick, let me know what you think of this approach. Thanks.
9 years, 5 months ago (2011-07-06 07:20:57 UTC) #1
ncarter (slow)
http://codereview.chromium.org/7259005/diff/2037/chrome/test/live_sync/live_sync_test.h File chrome/test/live_sync/live_sync_test.h (right): http://codereview.chromium.org/7259005/diff/2037/chrome/test/live_sync/live_sync_test.h#newcode115 chrome/test/live_sync/live_sync_test.h:115: void DisableVerifier(); Best to avoid per-datatype methods in LiveSyncTest ...
9 years, 5 months ago (2011-07-06 17:48:52 UTC) #2
Raghu Simha
Nick: I have a couple of responses (and no code changes) :) Let me know ...
9 years, 5 months ago (2011-07-07 02:14:03 UTC) #3
ncarter (slow)
http://codereview.chromium.org/7259005/diff/2037/chrome/test/live_sync/preferences_helper.h File chrome/test/live_sync/preferences_helper.h (right): http://codereview.chromium.org/7259005/diff/2037/chrome/test/live_sync/preferences_helper.h#newcode20 chrome/test/live_sync/preferences_helper.h:20: ~PreferencesHelper(); On 2011/07/07 02:14:04, rsimha wrote: > On 2011/07/06 ...
9 years, 5 months ago (2011-07-07 02:30:33 UTC) #4
tim (not reviewing)
On 2011/07/07 02:30:33, ncarter wrote: > http://codereview.chromium.org/7259005/diff/2037/chrome/test/live_sync/preferences_helper.h > File chrome/test/live_sync/preferences_helper.h (right): > > http://codereview.chromium.org/7259005/diff/2037/chrome/test/live_sync/preferences_helper.h#newcode20 > ...
9 years, 5 months ago (2011-07-07 05:28:43 UTC) #5
Raghu Simha
Tim/Nick: Please take another look. Some notes: - This patch now adds 2 static classes ...
9 years, 5 months ago (2011-07-12 13:01:17 UTC) #6
Raghu Simha
Ping. This is now ready for a full review, with all TODOs taken care of. ...
9 years, 5 months ago (2011-07-14 10:03:06 UTC) #7
Raghu Simha
Tim/Nick: Bumping this thread once again. I should be able to address comments / land ...
9 years, 5 months ago (2011-07-22 05:48:00 UTC) #8
Raghu Simha
+zea as reviewer, since Tim is OOO. Nicolas, could you take a look at this ...
9 years, 5 months ago (2011-07-25 08:12:32 UTC) #9
Nicolas Zea
On 2011/07/25 08:12:32, rsimha wrote: > +zea as reviewer, since Tim is OOO. > > ...
9 years, 5 months ago (2011-07-26 02:24:41 UTC) #10
Raghu Simha
Tim: Bumpity bump!
9 years, 5 months ago (2011-07-27 10:49:26 UTC) #11
tim (not reviewing)
this LGTM, remind me again why we couldn't go with a non-static class member for ...
9 years, 5 months ago (2011-07-28 05:22:41 UTC) #12
Raghu Simha
9 years, 4 months ago (2011-07-28 09:36:54 UTC) #13
Thanks for the review.

I chose the static-helper-class implementation over
non-static-member-of-LiveSyncTest due to the following reasons:

- In terms of added code, there wasn't much difference. ("alice.ChangeListPref"
vs. "PreferencesHelper::ChangeListPref")
- With static helpers, there's the notion of associating them with a test
instance (which happens automatically in the constructor of LiveSyncTest). All a
test case writer has to do in order to use a helper class in a new set of tests
is include a header file and invoke the helper method of choice.
- Meanwhile, if we were to use helpers that are non-static members of
LiveSyncTest, individual test classes (and perhaps, test cases) would need to
keep track of which helpers they're using and manage their lifetimes. 
- Also, with static helpers, adding a helper class for a new datatype involves
no changes to LiveSyncTest, while with non-static members, LiveSyncTest needs to
be updated every time a new datatype is added.

http://codereview.chromium.org/7259005/diff/34001/chrome/test/live_sync/bookm...
File chrome/test/live_sync/bookmarks_helper.cc (right):

http://codereview.chromium.org/7259005/diff/34001/chrome/test/live_sync/bookm...
chrome/test/live_sync/bookmarks_helper.cc:307: if (test()->use_verifier()) {
I implemented this via a dynamic check because a test case (a.k.a. an instance
of XXXClientBookmarksSyncTest) can decide to stop using the verifier midway
through the flow. Unless I'm wrong, using the inheritance model you suggest
would require tests to switch from using "BookmarksHelperWithVerifier" to a
"BookmarksHelperWithoutVerifier", which might end up being more complicated and
error prone than the check above. 

Example flow:

SetupSync();
ClientAChangesSomething(); // Same change made to verifier
ClientA->WaitForClientB();
VerifyAllClientsMatchVerifier(); // A = B = Verifier

DisableVerifier(); // Verifier is disregarded from here on
ClientAChangesSomething();
ClientBMakesAConflictingChange();
AwaitQuiescence(); //  End state is non-deterministic
VerifyAllClientsMatch(); // A = B

http://codereview.chromium.org/7259005/diff/34001/chrome/test/live_sync/sync_...
File chrome/test/live_sync/sync_datatype_helper.cc (right):

http://codereview.chromium.org/7259005/diff/34001/chrome/test/live_sync/sync_...
chrome/test/live_sync/sync_datatype_helper.cc:15: ASSERT_TRUE(test != NULL) <<
"Cannot associate with null test.";
On 2011/07/28 05:22:41, timsteele wrote:
> ASSERT_NE 

Tried that earlier -- it turns out that the ASSERT_* macros don't support
pointer types like LiveSyncTest* because NULL is defined as the integer 0.

error C2446: '!=' : no conversion from 'LiveSyncTest *const ' to 'const int'

http://codereview.chromium.org/7259005/diff/34001/chrome/test/live_sync/sync_...
chrome/test/live_sync/sync_datatype_helper.cc:22: EXPECT_TRUE(test_ != NULL) <<
"Must call AssociateWithTest first.";
On 2011/07/28 05:22:41, timsteele wrote:
> EXPECT_EQ

Same comment as above.

Powered by Google App Engine
This is Rietveld 408576698