services/sync/tests/tps/test_history_collision.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 /*
     5  * The list of phases mapped to their corresponding profiles.  The object
     6  * here must be in strict JSON format, as it will get parsed by the Python
     7  * testrunner (no single quotes, extra comma's, etc).
     8  */
     9 EnableEngines(["history"]);
    11 var phases = { "phase1": "profile1",
    12                "phase2": "profile2",
    13                "phase3": "profile1",
    14                "phase4": "profile2" };
    16 /*
    17  * History lists
    18  */
    20 // the initial list of history to add to the browser
    21 var history1 = [
    22    { uri: "http://www.google.com/",
    23      title: "Google",
    24      visits: [
    25        { type: 1,
    26          date: 0
    27        }
    28      ]
    29    },
    30    { uri: "http://www.cnn.com/",
    31      title: "CNN",
    32      visits: [
    33        { type: 1,
    34          date: -1
    35        },
    36        { type: 2,
    37          date: -36
    38        }
    39      ]
    40    },
    41    { uri: "http://www.mozilla.com/",
    42      title: "Mozilla",
    43      visits: [
    44        { type: 1,
    45          date: 0
    46        },
    47        { type: 2,
    48          date: -36
    49        }
    50      ]
    51    }
    52 ];
    54 // the history to delete
    55 var history_to_delete = [
    56    { uri: "http://www.cnn.com/",
    57      title: "CNN"
    58    },
    59    { begin: -36,
    60      end: -1
    61    }
    62 ];
    64 var history_not = [
    65    { uri: "http://www.cnn.com/",
    66      title: "CNN",
    67      visits: [
    68        { type: 1,
    69          date: -1
    70        },
    71        { type: 2,
    72          date: -36
    73        }
    74      ]
    75    }
    76 ];
    78 var history_after_delete = [
    79    { uri: "http://www.google.com/",
    80      title: "Google",
    81      visits: [
    82        { type: 1,
    83          date: 0
    84        }
    85      ]
    86    },
    87    { uri: "http://www.mozilla.com/",
    88      title: "Mozilla",
    89      visits: [
    90        { type: 1,
    91          date: 0
    92        }
    93      ]
    94    }
    95 ];
    97 /*
    98  * Test phases
    99  */
   101 Phase('phase1', [
   102   [History.add, history1],
   103   [Sync]
   104 ]);
   106 Phase('phase2', [
   107   [History.add, history1],
   108   [Sync, SYNC_WIPE_REMOTE]
   109 ]);
   111 Phase('phase3', [
   112   [Sync],
   113   [History.verify, history1],
   114   [History.delete, history_to_delete],
   115   [History.verify, history_after_delete],
   116   [History.verifyNot, history_not],
   117   [Sync]
   118 ]);
   120 Phase('phase4', [
   121   [Sync],
   122   [History.verify, history_after_delete],
   123   [History.verifyNot, history_not]
   124 ]);

mercurial