Bug 1062894 - Fix wrong assumption in test-places-events.js. r=mossop
authorMarco Bonardo <mbonardo@mozilla.com>
Fri, 08 May 2015 12:43:17 +0200
changeset 274327 0070705f844296d7d79a7dc0ae544dd44d100bab
parent 274326 9a5bd1aa9bcef8d603de4aa684f34f0801a68e5f
child 274328 045bd99f20246714bf7ffa1e9c7d2109627e6826
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmossop
bugs1062894
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1062894 - Fix wrong assumption in test-places-events.js. r=mossop
addon-sdk/source/test/addons/places/lib/places-helper.js
addon-sdk/source/test/addons/places/lib/test-places-events.js
--- a/addon-sdk/source/test/addons/places/lib/places-helper.js
+++ b/addon-sdk/source/test/addons/places/lib/places-helper.js
@@ -138,16 +138,21 @@ function createBookmark (data) {
       undefined),
     type: data.type || 'bookmark',
     group: data.group
   };
   return send('sdk-places-bookmarks-create', item);
 }
 exports.createBookmark = createBookmark;
 
+function historyBatch () {
+  hsrv.runInBatchMode(() => {}, null);
+}
+exports.historyBatch = historyBatch;
+
 function createBookmarkItem (data) {
   let deferred = defer();
   data = data || {};
   save({
     title: data.title || 'Moz',
     url: data.url || 'http://moz.com/',
     tags: data.tags || (!data.type || data.type === 'bookmark' ?
       ['firefox'] :
--- a/addon-sdk/source/test/addons/places/lib/test-places-events.js
+++ b/addon-sdk/source/test/addons/places/lib/test-places-events.js
@@ -24,17 +24,17 @@ const isOSX10_6 = (() => {
   let vString = release();
   return vString && /darwin/.test(platform()) && /10\.6/.test(vString);
 })();
 
 const { search } = require('sdk/places/history');
 const {
   invalidResolve, invalidReject, createTree, createBookmark,
   compareWithHost, addVisits, resetPlaces, createBookmarkItem,
-  removeVisits
+  removeVisits, historyBatch
 } = require('./places-helper');
 const { save, MENU, UNSORTED } = require('sdk/places/bookmarks');
 const { promisedEmitter } = require('sdk/places/utils');
 
 exports['test bookmark-item-added'] = function (assert, done) {
   events.on('data', function handler ({type, data}) {
     if (type !== 'bookmark-item-added') return;
     if (data.title !== 'bookmark-added-title') return;
@@ -231,19 +231,18 @@ exports['test history-start-batch, histo
       'history-start-clear has correct type');
     off(clearEvent, 'data', clearHandler);
     complete();
   }
 
   on(startEvent, 'data', startHandler);
   on(clearEvent, 'data', clearHandler);
 
-  createBookmark().then(() => {
-    resetPlaces(complete);
-  })
+  historyBatch();
+  resetPlaces(complete);
 };
 
 exports['test history-visit, history-title-changed'] = function (assert, done) {
   let complete = makeCompleted(() => {
     off(titleEvents, 'data', titleHandler);
     off(visitEvents, 'data', visitHandler);
     done();
   }, 6);