| Index: chrome/test/data/extensions/api_test/history/test.js
|
| ===================================================================
|
| --- chrome/test/data/extensions/api_test/history/test.js (revision 30561)
|
| +++ chrome/test/data/extensions/api_test/history/test.js (working copy)
|
| @@ -487,112 +487,4 @@
|
| populateHistory([urls[itemsAdded]], function() { });
|
| });
|
| },
|
| -
|
| - // This test has the following format. From the main entry point we
|
| - // attach a listener and give that listener a state to callback on. After
|
| - // receipt of the first message we validate it is as excepted in
|
| - // 'firsPageVisit.' We update the callback to 'secondPageVisit' and modify
|
| - //the history.
|
| - function listenForAdd() {
|
| - function secondPageVisit(visited) {
|
| - // Update state machine.
|
| - itemVisitedCallback = null;
|
| - chrome.experimental.history.onVisited.removeListener(itemVisitedListener);
|
| -
|
| - // Validate the state.
|
| - countItemsInHistory(function(count) {
|
| - assertEq(2, count);
|
| - assertEq(PICASA_URL, visited.url);
|
| -
|
| - // The test has succeeded.
|
| - chrome.test.succeed();
|
| - });
|
| - };
|
| -
|
| - function firstPageVisit(visited) {
|
| - // Update state machine.
|
| - itemVisitedCallback = secondPageVisit;
|
| -
|
| - // Validate the state.
|
| - countItemsInHistory(function(count) {
|
| - assertEq(1, count);
|
| - assertEq(GOOGLE_URL, visited.url);
|
| -
|
| - // Transistion to next state.
|
| - populateHistory([PICASA_URL], function() {
|
| - });
|
| - });
|
| - };
|
| -
|
| - // Populate the history one item at a time.
|
| - itemVisitedCallback = firstPageVisit;
|
| - chrome.experimental.history.onVisited.addListener(itemVisitedListener);
|
| -
|
| - chrome.experimental.history.deleteAll(function() {
|
| - populateHistory([GOOGLE_URL], function() {
|
| - });
|
| - });
|
| - },
|
| -
|
| - function listenForDelete() {
|
| - var urls = [GOOGLE_URL, PICASA_URL];
|
| - var visited_urls = {};
|
| -
|
| - // Callback for deletions.
|
| - function deleteRangeCallback(removed) {
|
| - // We will no longer need to listen to deletions.
|
| - itemRemovedCallback = null;
|
| - chrome.experimental.history.onVisitRemoved.removeListener(
|
| - itemRemovedListener);
|
| -
|
| - // The two added urls should have been deleted together.
|
| - assertEq(false, removed.allHistory);
|
| - assertEq(2, removed.urls.length);
|
| -
|
| - // History should be empty.
|
| - countItemsInHistory(function(count) {
|
| - assertEq(0, count);
|
| -
|
| - // The test has succeeded.
|
| - chrome.test.succeed();
|
| - });
|
| - };
|
| -
|
| - // Callback for page visits.
|
| - function historyPopulatedCallback(visited) {
|
| - visited_urls[visited_urls.length] = visited.url;
|
| -
|
| - if (visited_urls.length < urls.length) {
|
| - return;
|
| - }
|
| -
|
| - // We will no longer need to listen to visits.
|
| - itemVisitedCallback = null;
|
| - chrome.experimental.history.onVisited.removeListener(itemVisitedListener);
|
| - countItemsInHistory(function(count) {
|
| - assertEq(2, count);
|
| -
|
| - var startDate = new Date();
|
| - startDate.setDate(startDate.getDate() - 1);
|
| - var endDate = new Date();
|
| - chrome.experimental.history.deleteRange(
|
| - { 'startTime': startDate.getTime(), 'endTime': endDate.getTime() },
|
| - function() { });
|
| - });
|
| - };
|
| -
|
| - // We must be called back after the initial
|
| - itemVisitedCallback = historyPopulatedCallback;
|
| - chrome.experimental.history.onVisited.addListener(itemVisitedListener);
|
| -
|
| - chrome.experimental.history.deleteAll(function() {
|
| - // Do not add the listener until after we have reset the state of history.
|
| - itemRemovedCallback = deleteRangeCallback;
|
| - chrome.experimental.history.onVisitRemoved.addListener(
|
| - itemRemovedListener);
|
| -
|
| - // This call triggers the onVisited event handler.
|
| - populateHistory(urls, function() { });
|
| - });
|
| - },
|
| ]);
|
|
|