services/sync/tests/tps/test_history.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.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,167 @@
     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 +
    1.17 +/*
    1.18 + * History asset lists: these define history entries that are used during
    1.19 + * the test
    1.20 + */
    1.21 +
    1.22 +// the initial list of history items to add to the browser
    1.23 +var history1 = [
    1.24 +  { uri: "http://www.google.com/",
    1.25 +    title: "Google",
    1.26 +    visits: [
    1.27 +      { type: 1,
    1.28 +        date: 0
    1.29 +      },
    1.30 +      { type: 2,
    1.31 +        date: -1
    1.32 +      }
    1.33 +    ]
    1.34 +  },
    1.35 +  { uri: "http://www.cnn.com/",
    1.36 +    title: "CNN",
    1.37 +    visits: [
    1.38 +      { type: 1,
    1.39 +        date: -1
    1.40 +      },
    1.41 +      { type: 2,
    1.42 +        date: -36
    1.43 +      }
    1.44 +    ]
    1.45 +  },
    1.46 +  { uri: "http://www.google.com/language_tools?hl=en",
    1.47 +    title: "Language Tools",
    1.48 +    visits: [
    1.49 +      { type: 1,
    1.50 +        date: 0
    1.51 +      },
    1.52 +      { type: 2,
    1.53 +        date: -40
    1.54 +      }
    1.55 +    ]
    1.56 +  },
    1.57 +  { uri: "http://www.mozilla.com/",
    1.58 +    title: "Mozilla",
    1.59 +    visits: [
    1.60 +      { type: 1,
    1.61 +        date: 0
    1.62 +      },
    1.63 +      { type: 1,
    1.64 +        date: -1
    1.65 +      },
    1.66 +      { type: 1,
    1.67 +        date: -20
    1.68 +      },
    1.69 +      { type: 2,
    1.70 +        date: -36
    1.71 +      }
    1.72 +    ]
    1.73 +  }
    1.74 +];
    1.75 +
    1.76 +// a list of items to delete from the history
    1.77 +var history_to_delete = [
    1.78 +  { uri: "http://www.cnn.com/" },
    1.79 +  { begin: -24,
    1.80 +    end: -1
    1.81 +  },
    1.82 +  { host: "www.google.com" }
    1.83 +];
    1.84 +
    1.85 +// a list which reflects items that should be in the history after
    1.86 +// the above items are deleted
    1.87 +var history2 = [
    1.88 +  { uri: "http://www.mozilla.com/",
    1.89 +    title: "Mozilla",
    1.90 +    visits: [
    1.91 +      { type: 1,
    1.92 +        date: 0
    1.93 +      },
    1.94 +      { type: 2,
    1.95 +        date: -36
    1.96 +      }
    1.97 +    ]
    1.98 +  }
    1.99 +];
   1.100 +
   1.101 +// a list which includes history entries that should not be present
   1.102 +// after deletion of the history_to_delete entries
   1.103 +var history_not = [
   1.104 +  { uri: "http://www.google.com/",
   1.105 +    title: "Google",
   1.106 +    visits: [
   1.107 +      { type: 1,
   1.108 +        date: 0
   1.109 +      },
   1.110 +      { type: 2,
   1.111 +        date: -1
   1.112 +      }
   1.113 +    ]
   1.114 +  },
   1.115 +  { uri: "http://www.cnn.com/",
   1.116 +    title: "CNN",
   1.117 +    visits: [
   1.118 +      { type: 1,
   1.119 +        date: -1
   1.120 +      },
   1.121 +      { type: 2,
   1.122 +        date: -36
   1.123 +      }
   1.124 +    ]
   1.125 +  },
   1.126 +  { uri: "http://www.google.com/language_tools?hl=en",
   1.127 +    title: "Language Tools",
   1.128 +    visits: [
   1.129 +      { type: 1,
   1.130 +        date: 0
   1.131 +      },
   1.132 +      { type: 2,
   1.133 +        date: -40
   1.134 +      }
   1.135 +    ]
   1.136 +  },
   1.137 +  { uri: "http://www.mozilla.com/",
   1.138 +    title: "Mozilla",
   1.139 +    visits: [
   1.140 +      { type: 1,
   1.141 +        date: -1
   1.142 +      },
   1.143 +      { type: 1,
   1.144 +        date: -20
   1.145 +      }
   1.146 +    ]
   1.147 +  }
   1.148 +];
   1.149 +
   1.150 +/*
   1.151 + * Test phases
   1.152 + * Note:  there is no test phase in which deleted history entries are
   1.153 + * synced to other clients.  This functionality is not supported by
   1.154 + * Sync, see bug 446517.
   1.155 + */
   1.156 +
   1.157 +Phase('phase1', [
   1.158 +  [History.add, history1],
   1.159 +  [Sync],
   1.160 +]);
   1.161 +
   1.162 +Phase('phase2', [
   1.163 +  [Sync],
   1.164 +  [History.verify, history1],
   1.165 +  [History.delete, history_to_delete],
   1.166 +  [History.verify, history2],
   1.167 +  [History.verifyNot, history_not],
   1.168 +  [Sync]
   1.169 +]);
   1.170 +

mercurial