services/sync/tests/tps/test_history.js

Wed, 31 Dec 2014 07:53:36 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:53:36 +0100
branch
TOR_BUG_3246
changeset 5
4ab42b5ab56c
permissions
-rw-r--r--

Correct small whitespace inconsistency, lost while renaming variables.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 /*
michael@0 5 * The list of phases mapped to their corresponding profiles. The object
michael@0 6 * here must be in strict JSON format, as it will get parsed by the Python
michael@0 7 * testrunner (no single quotes, extra comma's, etc).
michael@0 8 */
michael@0 9 EnableEngines(["history"]);
michael@0 10
michael@0 11 var phases = { "phase1": "profile1",
michael@0 12 "phase2": "profile2" };
michael@0 13
michael@0 14 /*
michael@0 15 * History asset lists: these define history entries that are used during
michael@0 16 * the test
michael@0 17 */
michael@0 18
michael@0 19 // the initial list of history items to add to the browser
michael@0 20 var history1 = [
michael@0 21 { uri: "http://www.google.com/",
michael@0 22 title: "Google",
michael@0 23 visits: [
michael@0 24 { type: 1,
michael@0 25 date: 0
michael@0 26 },
michael@0 27 { type: 2,
michael@0 28 date: -1
michael@0 29 }
michael@0 30 ]
michael@0 31 },
michael@0 32 { uri: "http://www.cnn.com/",
michael@0 33 title: "CNN",
michael@0 34 visits: [
michael@0 35 { type: 1,
michael@0 36 date: -1
michael@0 37 },
michael@0 38 { type: 2,
michael@0 39 date: -36
michael@0 40 }
michael@0 41 ]
michael@0 42 },
michael@0 43 { uri: "http://www.google.com/language_tools?hl=en",
michael@0 44 title: "Language Tools",
michael@0 45 visits: [
michael@0 46 { type: 1,
michael@0 47 date: 0
michael@0 48 },
michael@0 49 { type: 2,
michael@0 50 date: -40
michael@0 51 }
michael@0 52 ]
michael@0 53 },
michael@0 54 { uri: "http://www.mozilla.com/",
michael@0 55 title: "Mozilla",
michael@0 56 visits: [
michael@0 57 { type: 1,
michael@0 58 date: 0
michael@0 59 },
michael@0 60 { type: 1,
michael@0 61 date: -1
michael@0 62 },
michael@0 63 { type: 1,
michael@0 64 date: -20
michael@0 65 },
michael@0 66 { type: 2,
michael@0 67 date: -36
michael@0 68 }
michael@0 69 ]
michael@0 70 }
michael@0 71 ];
michael@0 72
michael@0 73 // a list of items to delete from the history
michael@0 74 var history_to_delete = [
michael@0 75 { uri: "http://www.cnn.com/" },
michael@0 76 { begin: -24,
michael@0 77 end: -1
michael@0 78 },
michael@0 79 { host: "www.google.com" }
michael@0 80 ];
michael@0 81
michael@0 82 // a list which reflects items that should be in the history after
michael@0 83 // the above items are deleted
michael@0 84 var history2 = [
michael@0 85 { uri: "http://www.mozilla.com/",
michael@0 86 title: "Mozilla",
michael@0 87 visits: [
michael@0 88 { type: 1,
michael@0 89 date: 0
michael@0 90 },
michael@0 91 { type: 2,
michael@0 92 date: -36
michael@0 93 }
michael@0 94 ]
michael@0 95 }
michael@0 96 ];
michael@0 97
michael@0 98 // a list which includes history entries that should not be present
michael@0 99 // after deletion of the history_to_delete entries
michael@0 100 var history_not = [
michael@0 101 { uri: "http://www.google.com/",
michael@0 102 title: "Google",
michael@0 103 visits: [
michael@0 104 { type: 1,
michael@0 105 date: 0
michael@0 106 },
michael@0 107 { type: 2,
michael@0 108 date: -1
michael@0 109 }
michael@0 110 ]
michael@0 111 },
michael@0 112 { uri: "http://www.cnn.com/",
michael@0 113 title: "CNN",
michael@0 114 visits: [
michael@0 115 { type: 1,
michael@0 116 date: -1
michael@0 117 },
michael@0 118 { type: 2,
michael@0 119 date: -36
michael@0 120 }
michael@0 121 ]
michael@0 122 },
michael@0 123 { uri: "http://www.google.com/language_tools?hl=en",
michael@0 124 title: "Language Tools",
michael@0 125 visits: [
michael@0 126 { type: 1,
michael@0 127 date: 0
michael@0 128 },
michael@0 129 { type: 2,
michael@0 130 date: -40
michael@0 131 }
michael@0 132 ]
michael@0 133 },
michael@0 134 { uri: "http://www.mozilla.com/",
michael@0 135 title: "Mozilla",
michael@0 136 visits: [
michael@0 137 { type: 1,
michael@0 138 date: -1
michael@0 139 },
michael@0 140 { type: 1,
michael@0 141 date: -20
michael@0 142 }
michael@0 143 ]
michael@0 144 }
michael@0 145 ];
michael@0 146
michael@0 147 /*
michael@0 148 * Test phases
michael@0 149 * Note: there is no test phase in which deleted history entries are
michael@0 150 * synced to other clients. This functionality is not supported by
michael@0 151 * Sync, see bug 446517.
michael@0 152 */
michael@0 153
michael@0 154 Phase('phase1', [
michael@0 155 [History.add, history1],
michael@0 156 [Sync],
michael@0 157 ]);
michael@0 158
michael@0 159 Phase('phase2', [
michael@0 160 [Sync],
michael@0 161 [History.verify, history1],
michael@0 162 [History.delete, history_to_delete],
michael@0 163 [History.verify, history2],
michael@0 164 [History.verifyNot, history_not],
michael@0 165 [Sync]
michael@0 166 ]);
michael@0 167

mercurial