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

Unified Diff: chrome/test/data/webui/history_browsertest.js

Issue 22862006: "domain" item added to HistoryEntry to allow showing IDN in chrome://history/ (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 3 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/history_ui.cc ('k') | chrome/test/data/webui/history_ui_browsertest.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/history_browsertest.js
===================================================================
--- chrome/test/data/webui/history_browsertest.js (revision 216076)
+++ chrome/test/data/webui/history_browsertest.js (working copy)
@@ -22,6 +22,9 @@
*/
function createHistoryEntry(timestamp, url) {
var d = new Date(timestamp);
+ // Extract domain from url.
+ var domainMatch = url.replace(/^.+?:\/\//, '').match(/[^/]+/);
+ var domain = domainMatch ? domainMatch[0] : '';
return {
dateTimeOfDay: d.getHours() + ':' + d.getMinutes(),
dateRelativeDay: d.toDateString(),
@@ -29,7 +32,8 @@
starred: false,
time: timestamp,
title: d.toString(), // Use the stringified date as the title.
- url: url
+ url: url,
+ domain: domain
};
}
@@ -828,3 +832,37 @@
});
waitForCallback('deleteFailed', testDone);
});
+
+/**
+ * Fixture for History WebUI testing IDN.
+ * @extends {BaseHistoryWebUITest}
+ * @constructor
+ */
+function HistoryWebUIIDNTest() {}
+
+HistoryWebUIIDNTest.prototype = {
+ __proto__: BaseHistoryWebUITest.prototype,
+
+ /** @override */
+ testGenPreamble: function() {
+ // Add some visits to the history database.
+ GEN(' AddPageToHistory(0, "http://xn--d1abbgf6aiiy.xn--p1ai/",' +
+ ' "Some");');
+
+ // Clear AcceptLanguages to get domain in unicode.
+ GEN(' ClearAcceptLanguages();');
+ },
+};
+
+/**
+ * Simple test that verifies that the correct entries are retrieved from the
+ * history database and displayed in the UI.
+ */
+TEST_F('HistoryWebUIIDNTest', 'basic', function() {
+ // Check that there is only one entry and domain is in unicode.
+ assertEquals(1, document.querySelectorAll('.domain').length);
+ assertEquals("\u043f\u0440\u0435\u0437\u0438\u0434\u0435\u043d\u0442." +
+ "\u0440\u0444", document.querySelector('.domain').textContent);
+
+ testDone();
+});
« no previous file with comments | « chrome/browser/ui/webui/history_ui.cc ('k') | chrome/test/data/webui/history_ui_browsertest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698