Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Unified Diff: chrome/test/data/webui/md_history/history_card_manager_test.js

Issue 1586373002: MD History: Delete button in the toolbar allows deletion of multiple history-items. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@patch_to_be_uploaded
Patch Set: Fix supervised user test. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/md_history_ui.cc ('k') | chrome/test/data/webui/md_history/history_card_test.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/md_history/history_card_manager_test.js
diff --git a/chrome/test/data/webui/md_history/history_card_manager_test.js b/chrome/test/data/webui/md_history/history_card_manager_test.js
index 6e511db02cf9cefe060bc1ddab1d7ad87a2a1da0..3b19e2b1fdfe68e45bd0cbb82a3c0fae33be4599 100644
--- a/chrome/test/data/webui/md_history/history_card_manager_test.js
+++ b/chrome/test/data/webui/md_history/history_card_manager_test.js
@@ -7,19 +7,23 @@ cr.define('md_history.history_card_manager_test', function() {
var TEST_HISTORY_RESULTS = [
{
"dateRelativeDay": "Today - Wednesday, December 9, 2015",
- "url": "https://www.google.com"
+ "url": "https://www.google.com",
+ "allTimestamps": "1",
},
{
"dateRelativeDay": "Yesterday - Tuesday, December 8, 2015",
- "url": "https://en.wikipedia.com"
+ "url": "https://en.wikipedia.com",
+ "allTimestamps": "2"
},
{
"dateRelativeDay": "Monday, December 7, 2015",
- "url": "https://www.example.com"
+ "url": "https://www.example.com",
+ "allTimestamps": "3"
},
{
"dateRelativeDay": "Monday, December 7, 2015",
- "url": "https://www.google.com"
+ "url": "https://www.google.com",
+ "allTimestamps": "4"
}
];
@@ -45,9 +49,13 @@ cr.define('md_history.history_card_manager_test', function() {
function registerTests() {
suite('history-card-manager', function() {
var element;
+ var toolbar;
+ var items;
suiteSetup(function() {
element = $('history-card-manager');
+ toolbar = $('toolbar');
+ items = [];
});
setup(function() {
@@ -71,12 +79,10 @@ cr.define('md_history.history_card_manager_test', function() {
});
test('cancelling selection of multiple items', function(done) {
- var toolbar = $('toolbar');
-
flush(function() {
var cards = Polymer.dom(element.root)
.querySelectorAll('history-card');
- var items = Polymer.dom(cards[2].root)
+ items = Polymer.dom(cards[2].root)
.querySelectorAll('history-item');
MockInteractions.tap(items[0].$.checkbox);
@@ -129,8 +135,70 @@ cr.define('md_history.history_card_manager_test', function() {
element.historyDataByDay_[4].historyItems[0].url);
});
+ test('removeVisits for multiple items', function(done) {
+ // Ensure that the correct identifying data is being used for removal.
+ registerMessageCallback('removeVisits', this, function (toBeRemoved) {
+ assertEquals(toBeRemoved[0].url,
+ element.historyDataByDay_[2].historyItems[0].url);
+ assertEquals(toBeRemoved[1].url,
+ element.historyDataByDay_[2].historyItems[1].url);
+ assertEquals(toBeRemoved[0].timestamps,
+ element.historyDataByDay_[2].historyItems[0]
+ .allTimestamps);
+ assertEquals(toBeRemoved[1].timestamps,
+ element.historyDataByDay_[2].historyItems[1]
+ .allTimestamps);
+ done();
+ });
+
+ flush(function() {
+ var cards = Polymer.dom(element.root)
+ .querySelectorAll('history-card');
+ items = Polymer.dom(cards[2].root)
+ .querySelectorAll('history-item');
+
+ MockInteractions.tap(items[0].$['checkbox']);
+ MockInteractions.tap(items[1].$['checkbox']);
+
+ toolbar.onDeleteTap_();
+ });
+ });
+
+ test('deleting multiple items from view', function(done) {
+ flush(function() {
+ var cards = Polymer.dom(element.root)
+ .querySelectorAll('history-card');
+ items = Polymer.dom(cards[2].root)
+ .querySelectorAll('history-item');
+
+ MockInteractions.tap(items[0].$['checkbox']);
+ MockInteractions.tap(items[1].$['checkbox']);
+
+ element.removeDeletedHistory(2);
+
+ flush(function() {
+ var cards = Polymer.dom(element.root)
+ .querySelectorAll('history-card');
+ items = Polymer.dom(cards[2].root)
+ .querySelectorAll('history-item');
+
+ assertEquals(element.historyDataByDay_.length, 2);
+ assertEquals(element.historyDataByDay_[0].date,
+ "Today - Wednesday, December 9, 2015");
+ assertEquals(element.historyDataByDay_[1].date,
+ "Yesterday - Tuesday, December 8, 2015");
+ assertEquals(items.length, 0);
+ done();
+ });
+ });
+ });
+
teardown(function() {
+ for (var i = 0; i < items.length; i++) {
+ items[i].selected = false;
+ }
element.historyDataByDay_ = [];
+ toolbar.count = 0;
});
});
}
« no previous file with comments | « chrome/browser/ui/webui/md_history_ui.cc ('k') | chrome/test/data/webui/md_history/history_card_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698