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

Unified Diff: third_party/WebKit/Source/devtools/front_end/shell/TestShell.js

Issue 2513423003: DevTools: Convert inspector-unit tests to use reusable test harness (Closed)
Patch Set: create shell module Created 4 years, 1 month 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
Index: third_party/WebKit/Source/devtools/front_end/shell/TestShell.js
diff --git a/third_party/WebKit/Source/devtools/front_end/shell/TestShell.js b/third_party/WebKit/Source/devtools/front_end/shell/TestShell.js
new file mode 100644
index 0000000000000000000000000000000000000000..2081b1814a81802ae0cec16781773c51f7abca28
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/front_end/shell/TestShell.js
@@ -0,0 +1,44 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+Shell.TestShell = class {
+ /**
+ * @suppressGlobalPropertiesCheck
+ */
+ constructor() {
+ if (self.document.readyState === 'complete' || self.document.readyState === 'interactive')
+ this.initializeUnitTest();
+ else
+ document.addEventListener('DOMContentLoaded', () => this.initializeUnitTest());
dgozman 2016/11/30 18:19:54 There is runOnWindowLoad function in DOMExtension.
chenwilliam 2016/11/30 19:53:08 Done.
+ }
+
+ /**
+ * @suppressGlobalPropertiesCheck
+ */
+ initializeUnitTest() {
+ var globalStorage = new Common.SettingsStorage(
+ {}, InspectorFrontendHost.setPreference, InspectorFrontendHost.removePreference,
+ InspectorFrontendHost.clearPreferences);
+ var storagePrefix = '';
+ var localStorage = new Common.SettingsStorage({}, undefined, undefined, undefined, storagePrefix);
+ Common.settings = new Common.Settings(globalStorage, localStorage);
+
+ UI.viewManager = new UI.ViewManager();
+ UI.initializeUIUtils(document, Common.settings.createSetting('uiTheme', 'default'));
+ UI.installComponentRootStyles(/** @type {!Element} */ (document.body));
+
+ UI.zoomManager = new UI.ZoomManager(self, InspectorFrontendHost);
+ UI.inspectorView = UI.InspectorView.instance();
+ UI.ContextMenu.initialize();
+ UI.ContextMenu.installHandler(document);
+ UI.Tooltip.installHandler(document);
+
+ var rootView = new UI.RootView();
+ UI.inspectorView.show(rootView.element);
+ rootView.attachToDocument(document);
+ TestRunner.executeTestScript();
+ }
+};
+
+new Shell.TestShell();

Powered by Google App Engine
This is Rietveld 408576698