test_history_collision.js (1939B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 EnableEngines(["history"]); 5 6 /* 7 * The list of phases mapped to their corresponding profiles. The object 8 * here must be in JSON format as it will get parsed by the Python 9 * testrunner. It is parsed by the YAML package, so it relatively flexible. 10 */ 11 var phases = { 12 phase1: "profile1", 13 phase2: "profile2", 14 phase3: "profile1", 15 phase4: "profile2", 16 }; 17 18 /* 19 * History lists 20 */ 21 22 // the initial list of history to add to the browser 23 var history1 = [ 24 { 25 uri: "http://www.google.com/", 26 title: "Google", 27 visits: [{ type: 1, date: 0 }], 28 }, 29 { 30 uri: "http://www.cnn.com/", 31 title: "CNN", 32 visits: [ 33 { type: 1, date: -1 }, 34 { type: 2, date: -36 }, 35 ], 36 }, 37 { 38 uri: "http://www.mozilla.com/", 39 title: "Mozilla", 40 visits: [ 41 { type: 1, date: 0 }, 42 { type: 2, date: -36 }, 43 ], 44 }, 45 ]; 46 47 // the history to delete 48 var history_to_delete = [ 49 { uri: "http://www.cnn.com/", title: "CNN" }, 50 { begin: -36, end: -1 }, 51 ]; 52 53 var history_not = [ 54 { 55 uri: "http://www.cnn.com/", 56 title: "CNN", 57 visits: [ 58 { type: 1, date: -1 }, 59 { type: 2, date: -36 }, 60 ], 61 }, 62 ]; 63 64 var history_after_delete = [ 65 { 66 uri: "http://www.google.com/", 67 title: "Google", 68 visits: [{ type: 1, date: 0 }], 69 }, 70 { 71 uri: "http://www.mozilla.com/", 72 title: "Mozilla", 73 visits: [{ type: 1, date: 0 }], 74 }, 75 ]; 76 77 /* 78 * Test phases 79 */ 80 81 Phase("phase1", [[History.add, history1], [Sync]]); 82 83 Phase("phase2", [[Sync], [History.add, history1], [Sync, SYNC_WIPE_REMOTE]]); 84 85 Phase("phase3", [ 86 [Sync], 87 [History.verify, history1], 88 [History.delete, history_to_delete], 89 [History.verify, history_after_delete], 90 [History.verifyNot, history_not], 91 [Sync], 92 ]); 93 94 Phase("phase4", [ 95 [Sync], 96 [History.verify, history_after_delete], 97 [History.verifyNot, history_not], 98 ]);