Bug 1533288 - Add an executable to insert IE history on test machines. r=jaws,firefox-build-system-reviewers,mshal
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Wed, 13 Mar 2019 03:12:08 +0000
changeset 524647 7651c91b361bd77945e43080fdb171fa4111d96f
parent 524646 5a255779e2a73972472450a89e2c87d055b88870
child 524648 53ab271d602016d35cce17633ac0fe646230a470
push id2032
push userffxbld-merge
push dateMon, 13 May 2019 09:36:57 +0000
treeherdermozilla-release@455c1065dcbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws, firefox-build-system-reviewers, mshal
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 - Add an executable to insert IE history on test machines. r=jaws,firefox-build-system-reviewers,mshal Differential Revision: https://phabricator.services.mozilla.com/D22844
browser/components/migration/moz.build
browser/components/migration/tests/unit/insertIEHistory/InsertIEHistory.cpp
browser/components/migration/tests/unit/insertIEHistory/moz.build
--- a/browser/components/migration/moz.build
+++ b/browser/components/migration/moz.build
@@ -20,16 +20,20 @@ EXTRA_JS_MODULES += [
     'ChromeMigrationUtils.jsm',
     'ChromeProfileMigrator.jsm',
     'FirefoxProfileMigrator.jsm',
     'MigrationUtils.jsm',
     'ProfileMigrator.jsm',
 ]
 
 if CONFIG['OS_ARCH'] == 'WINNT':
+    if CONFIG['ENABLE_TESTS']:
+        DIRS += [
+            'tests/unit/insertIEHistory',
+        ]
     SOURCES += [
         'nsIEHistoryEnumerator.cpp',
     ]
     EXTRA_JS_MODULES += [
         '360seProfileMigrator.jsm',
         'EdgeProfileMigrator.jsm',
         'ESEDBReader.jsm',
         'IEProfileMigrator.jsm',
new file mode 100644
--- /dev/null
+++ b/browser/components/migration/tests/unit/insertIEHistory/InsertIEHistory.cpp
@@ -0,0 +1,35 @@
+/* Any copyright is dedicated to the Public Domain.
+ * https://creativecommons.org/publicdomain/zero/1.0/ */
+
+/**
+ * Insert URLs into Internet Explorer (IE) history so we can test importing
+ * them.
+ *
+ * See API docs at https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms774949(v%3dvs.85)
+ */
+
+#include <urlhist.h> // IUrlHistoryStg
+#include <shlguid.h> // SID_SUrlHistory
+
+int main(int argc, char** argv) {
+  HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
+  if (FAILED(hr)) {
+    CoUninitialize();
+    return -1;
+  }
+  IUrlHistoryStg* ieHist;
+
+  hr = ::CoCreateInstance(CLSID_CUrlHistory, nullptr, CLSCTX_INPROC_SERVER,
+                          IID_IUrlHistoryStg, reinterpret_cast<void**>(&ieHist));
+  if (FAILED(hr)) return -2;
+
+  hr = ieHist->AddUrl(L"http://www.mozilla.org/1", L"Mozilla HTTP Test", 0);
+  if (FAILED(hr)) return -3;
+
+  hr = ieHist->AddUrl(L"https://www.mozilla.org/2", L"Mozilla HTTPS Test 🦊", 0);
+  if (FAILED(hr)) return -4;
+
+  CoUninitialize();
+
+  return 0;
+}
new file mode 100644
--- /dev/null
+++ b/browser/components/migration/tests/unit/insertIEHistory/moz.build
@@ -0,0 +1,18 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+FINAL_TARGET = '_tests/xpcshell/browser/components/migration/tests/unit'
+
+Program('InsertIEHistory')
+OS_LIBS += [
+    'ole32',
+]
+SOURCES += [
+    'InsertIEHistory.cpp',
+]
+
+NO_PGO = True
+DisableStlWrapping()