Bug 1533288 - Test import of Internet Explorer history. r=jaws
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Wed, 13 Mar 2019 03:12:15 +0000
changeset 521650 53ab271d602016d35cce17633ac0fe646230a470
parent 521649 7651c91b361bd77945e43080fdb171fa4111d96f
child 521651 7cbe3fbc4b7f1c76a14ce40f074f8a9052540ee5
push id10867
push userdvarga@mozilla.com
push dateThu, 14 Mar 2019 15:20:45 +0000
treeherdermozilla-beta@abad13547875 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs1533288
milestone67.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 1533288 - Test import of Internet Explorer history. r=jaws Differential Revision: https://phabricator.services.mozilla.com/D22845
browser/components/migration/tests/unit/test_IE_history.js
browser/components/migration/tests/unit/xpcshell.ini
new file mode 100644
--- /dev/null
+++ b/browser/components/migration/tests/unit/test_IE_history.js
@@ -0,0 +1,50 @@
+"use strict";
+
+// These match what we add to IE via InsertIEHistory.exe.
+const TEST_ENTRIES = [
+{
+  url: "http://www.mozilla.org/1",
+  title: "Mozilla HTTP Test",
+},
+{
+  url: "https://www.mozilla.org/2",
+  // Test character encoding with a fox emoji:
+  title: "Mozilla HTTPS Test 🦊",
+},
+];
+
+function insertIEHistory() {
+  let file = do_get_file("InsertIEHistory.exe", false);
+  let process = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess);
+  process.init(file);
+
+  let args = [];
+  process.run(true, args, args.length);
+
+  Assert.ok(!process.isRunning, "Should be done running");
+  Assert.equal(process.exitValue, 0, "Check exit code");
+}
+
+add_task(async function setup() {
+  await PlacesUtils.history.clear();
+
+  insertIEHistory();
+
+  registerCleanupFunction(async () => {
+    await PlacesUtils.history.clear();
+  });
+});
+
+add_task(async function test_IE_history() {
+  let migrator = await MigrationUtils.getMigrator("ie");
+  Assert.ok(await migrator.isSourceAvailable(), "Source is available");
+
+  await promiseMigration(migrator, MigrationUtils.resourceTypes.HISTORY);
+
+  for (let {url, title} of TEST_ENTRIES) {
+    let entry = await PlacesUtils.history.fetch(url, {includeVisits: true});
+    Assert.equal(entry.url, url, "Should have the correct URL");
+    Assert.equal(entry.title, title, "Should have the correct title");
+    Assert.ok(entry.visits.length > 0, "Should have some visits");
+  }
+});
--- a/browser/components/migration/tests/unit/xpcshell.ini
+++ b/browser/components/migration/tests/unit/xpcshell.ini
@@ -19,13 +19,15 @@ skip-if = os != "win"
 [test_ChromeMigrationUtils_path.js]
 [test_Edge_db_migration.js]
 skip-if = os != "win"
 [test_fx_telemetry.js]
 [test_IE_bookmarks.js]
 skip-if = !(os == "win" && bits == 64) # bug 1392396
 [test_IE_cookies.js]
 skip-if = os != "win" || (os == "win" && bits == 64 && processor == "x86_64") # bug 1522818
+[test_IE_history.js]
+skip-if = os != "win"
 [test_IE7_passwords.js]
 skip-if = os != "win"
 [test_MigrationUtils_timedRetry.js]
 [test_Safari_bookmarks.js]
 skip-if = os != "mac"