services/sync/tests/tps/test_history_collision.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/services/sync/tests/tps/test_history_collision.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,125 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +/*
     1.8 + * The list of phases mapped to their corresponding profiles.  The object
     1.9 + * here must be in strict JSON format, as it will get parsed by the Python
    1.10 + * testrunner (no single quotes, extra comma's, etc).
    1.11 + */
    1.12 +EnableEngines(["history"]);
    1.13 +
    1.14 +var phases = { "phase1": "profile1",
    1.15 +               "phase2": "profile2",
    1.16 +               "phase3": "profile1",
    1.17 +               "phase4": "profile2" };
    1.18 +
    1.19 +/*
    1.20 + * History lists
    1.21 + */
    1.22 +
    1.23 +// the initial list of history to add to the browser
    1.24 +var history1 = [
    1.25 +   { uri: "http://www.google.com/",
    1.26 +     title: "Google",
    1.27 +     visits: [
    1.28 +       { type: 1,
    1.29 +         date: 0
    1.30 +       }
    1.31 +     ]
    1.32 +   },
    1.33 +   { uri: "http://www.cnn.com/",
    1.34 +     title: "CNN",
    1.35 +     visits: [
    1.36 +       { type: 1,
    1.37 +         date: -1
    1.38 +       },
    1.39 +       { type: 2,
    1.40 +         date: -36
    1.41 +       }
    1.42 +     ]
    1.43 +   },
    1.44 +   { uri: "http://www.mozilla.com/",
    1.45 +     title: "Mozilla",
    1.46 +     visits: [
    1.47 +       { type: 1,
    1.48 +         date: 0
    1.49 +       },
    1.50 +       { type: 2,
    1.51 +         date: -36
    1.52 +       }
    1.53 +     ]
    1.54 +   }
    1.55 +];
    1.56 +
    1.57 +// the history to delete
    1.58 +var history_to_delete = [
    1.59 +   { uri: "http://www.cnn.com/",
    1.60 +     title: "CNN"
    1.61 +   },
    1.62 +   { begin: -36,
    1.63 +     end: -1
    1.64 +   }
    1.65 +];
    1.66 +
    1.67 +var history_not = [
    1.68 +   { uri: "http://www.cnn.com/",
    1.69 +     title: "CNN",
    1.70 +     visits: [
    1.71 +       { type: 1,
    1.72 +         date: -1
    1.73 +       },
    1.74 +       { type: 2,
    1.75 +         date: -36
    1.76 +       }
    1.77 +     ]
    1.78 +   }
    1.79 +];
    1.80 +
    1.81 +var history_after_delete = [
    1.82 +   { uri: "http://www.google.com/",
    1.83 +     title: "Google",
    1.84 +     visits: [
    1.85 +       { type: 1,
    1.86 +         date: 0
    1.87 +       }
    1.88 +     ]
    1.89 +   },
    1.90 +   { uri: "http://www.mozilla.com/",
    1.91 +     title: "Mozilla",
    1.92 +     visits: [
    1.93 +       { type: 1,
    1.94 +         date: 0
    1.95 +       }
    1.96 +     ]
    1.97 +   }
    1.98 +];
    1.99 +
   1.100 +/*
   1.101 + * Test phases
   1.102 + */
   1.103 +
   1.104 +Phase('phase1', [
   1.105 +  [History.add, history1],
   1.106 +  [Sync]
   1.107 +]);
   1.108 +
   1.109 +Phase('phase2', [
   1.110 +  [History.add, history1],
   1.111 +  [Sync, SYNC_WIPE_REMOTE]
   1.112 +]);
   1.113 +
   1.114 +Phase('phase3', [
   1.115 +  [Sync],
   1.116 +  [History.verify, history1],
   1.117 +  [History.delete, history_to_delete],
   1.118 +  [History.verify, history_after_delete],
   1.119 +  [History.verifyNot, history_not],
   1.120 +  [Sync]
   1.121 +]);
   1.122 +
   1.123 +Phase('phase4', [
   1.124 +  [Sync],
   1.125 +  [History.verify, history_after_delete],
   1.126 +  [History.verifyNot, history_not]
   1.127 +]);
   1.128 +

mercurial