1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/services/sync/tests/tps/test_addon_reconciling.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,51 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +// This test verifies that record reconciling works as expected. It makes 1.8 +// similar changes to add-ons in separate profiles and does a sync to verify 1.9 +// the proper action is taken. 1.10 +EnableEngines(["addons"]); 1.11 + 1.12 +let phases = { 1.13 + "phase01": "profile1", 1.14 + "phase02": "profile2", 1.15 + "phase03": "profile1", 1.16 + "phase04": "profile2", 1.17 + "phase05": "profile1", 1.18 + "phase06": "profile2" 1.19 +}; 1.20 + 1.21 +const id = "restartless-xpi@tests.mozilla.org"; 1.22 + 1.23 +// Install the add-on in 2 profiles. 1.24 +Phase("phase01", [ 1.25 + [Addons.verifyNot, [id]], 1.26 + [Addons.install, [id]], 1.27 + [Addons.verify, [id], STATE_ENABLED], 1.28 + [Sync] 1.29 +]); 1.30 +Phase("phase02", [ 1.31 + [Addons.verifyNot, [id]], 1.32 + [Sync], 1.33 + [Addons.verify, [id], STATE_ENABLED] 1.34 +]); 1.35 + 1.36 +// Now we disable in one and uninstall in the other. 1.37 +Phase("phase03", [ 1.38 + [Sync], // Get GUID updates, potentially. 1.39 + [Addons.setEnabled, [id], STATE_DISABLED], 1.40 +]); 1.41 +Phase("phase04", [ 1.42 + [EnsureTracking], 1.43 + [Addons.uninstall, [id]], 1.44 + [Sync] 1.45 +]); 1.46 + 1.47 +// When we sync, the uninstall should take precedence because it was newer. 1.48 +Phase("phase05", [ 1.49 + [Sync] 1.50 +]); 1.51 +Phase("phase06", [ 1.52 + [Sync], 1.53 + [Addons.verifyNot, [id]] 1.54 +]);