/services/sync/tests/tps/test_history_collision.js

http://github.com/zpao/v8monkey · JavaScript · 125 lines · 97 code · 13 blank · 15 comment · 0 complexity · d1016f1ec17231d44f24c05df1e163b4 MD5 · raw file

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