PageRenderTime 15ms CodeModel.GetById 1ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/services/sync/tests/tps/test_privbrw_formdata.js

http://github.com/zpao/v8monkey
JavaScript | 73 lines | 48 code | 10 blank | 15 comment | 0 complexity | f3c0b16be93fc2a8e2afd1197d8cb7b7 MD5 | raw file
 1/* Any copyright is dedicated to the Public Domain.
 2   http://creativecommons.org/publicdomain/zero/1.0/ */
 3
 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 */
 9EnableEngines(["forms"]);
10
11var phases = { "phase1": "profile1",
12               "phase2": "profile2",
13               "phase3": "profile1",
14               "phase4": "profile2" };
15
16/*
17 * Form data
18 */
19
20// the form data to add to the browser
21var formdata1 = [
22   { fieldname: "name",
23     value: "xyz",
24     date: -1
25   },
26   { fieldname: "email",
27     value: "abc@gmail.com",
28     date: -2
29   },
30   { fieldname: "username",
31     value: "joe"
32   }
33];
34
35// the form data to add in private browsing mode
36var formdata2 = [
37   { fieldname: "password",
38     value: "secret",
39     date: -1
40   },
41   { fieldname: "city",
42     value: "mtview"
43   }
44];
45
46/*
47 * Test phases
48 */
49
50Phase('phase1', [
51  [Formdata.add, formdata1],
52  [Formdata.verify, formdata1],
53  [Sync]
54]);
55
56Phase('phase2', [
57  [Sync],
58  [Formdata.verify, formdata1]
59]);
60
61Phase('phase3', [
62  [Sync],
63  [SetPrivateBrowsing, true],
64  [Formdata.add, formdata2],
65  [Formdata.verify, formdata2],
66  [Sync],
67]);
68
69Phase('phase4', [
70  [Sync],
71  [Formdata.verify, formdata1],
72  [Formdata.verifyNot, formdata2]
73]);