| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 cr.define('md_history.browser_service_test', function() { | 5 suite('BrowserService', function() { |
| 6 function registerTests() { | 6 test('makes correct call to removeVisits', function(done) { |
| 7 suite('BrowserService', function() { | 7 registerMessageCallback('removeVisits', this, function(toRemove) { |
| 8 assertEquals('http://www.example.com', toRemove[0].url); |
| 9 assertEquals('https://en.wikipedia.org', toRemove[1].url); |
| 10 assertEquals(1234, toRemove[0].timestamps[0]); |
| 11 assertEquals(5678, toRemove[1].timestamps[0]); |
| 12 done(); |
| 13 }); |
| 8 | 14 |
| 9 test('makes correct call to removeVisits', function(done) { | 15 toDelete = [ |
| 16 createHistoryEntry(1234, 'http://www.example.com'), |
| 17 createHistoryEntry(5678, 'https://en.wikipedia.org') |
| 18 ]; |
| 10 | 19 |
| 11 registerMessageCallback('removeVisits', this, function(toRemove) { | 20 md_history.BrowserService.getInstance().deleteItems(toDelete); |
| 12 assertEquals('http://www.example.com', toRemove[0].url); | 21 }); |
| 13 assertEquals('https://en.wikipedia.org', toRemove[1].url); | |
| 14 assertEquals(1234, toRemove[0].timestamps[0]); | |
| 15 assertEquals(5678, toRemove[1].timestamps[0]); | |
| 16 done(); | |
| 17 }); | |
| 18 | 22 |
| 19 toDelete = [ | 23 teardown(function() { |
| 20 createHistoryEntry(1234, 'http://www.example.com'), | 24 registerMessageCallback('removeVisits', this, undefined); |
| 21 createHistoryEntry(5678, 'https://en.wikipedia.org') | 25 }); |
| 22 ]; | |
| 23 | |
| 24 md_history.BrowserService.getInstance().deleteItems(toDelete); | |
| 25 }); | |
| 26 | |
| 27 teardown(function() { | |
| 28 registerMessageCallback('removeVisits', this, undefined); | |
| 29 }); | |
| 30 | |
| 31 }); | |
| 32 } | |
| 33 return { | |
| 34 registerTests: registerTests | |
| 35 }; | |
| 36 }); | 26 }); |
| OLD | NEW |