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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/inspector-unit/view-location.js

Issue 2867133002: DevTools: Let the drawer tabs be reordered (Closed)
Patch Set: Add test Created 3 years, 7 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
Index: third_party/WebKit/LayoutTests/http/tests/inspector-unit/view-location.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector-unit/view-location.js b/third_party/WebKit/LayoutTests/http/tests/inspector-unit/view-location.js
new file mode 100644
index 0000000000000000000000000000000000000000..41de2d28b4139548cdf4605b57ce2737e14f3cd5
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector-unit/view-location.js
@@ -0,0 +1,63 @@
+class ClosableView extends UI.SimpleView {
+ isCloseable() {
+ return true;
+ }
+}
+
+var views = ['first', 'second', 'third', 'fourth'].map(title => new ClosableView(title));
+
+class MockViewManager {
+ constructor() {
+ /** @type {!Map<string, !UI.View>} */
+ this._views = new Map();
+
+ for (var view of views)
+ this._views.set(view.viewId(), view);
dgozman 2017/05/25 17:12:49 Instead of mock, should we inject real extensions
einbinder 2017/05/25 23:48:54 Done.
+ }
+
+ /**
+ * @param {string} location
+ * @return {!Array<!UI.View>}
+ */
+ _viewsForLocation(location) {
+ return Array.from(this._views.values());
+ }
+}
+
+var tabbedLocation;
+createTabbedLocation();
+dumpTabs();
+TestRunner.addResult('Appending three views')
+tabbedLocation.appendView(views[0]);
+tabbedLocation.appendView(views[1]);
+tabbedLocation.appendView(views[2]);
+dumpTabs();
+createTabbedLocation();
+dumpTabs();
+TestRunner.addResult('Re-order tabs');
+tabbedLocation.tabbedPane()._insertBefore(tabbedLocation.tabbedPane()._tabsById.get("third"), 0);
+dumpTabs();
+createTabbedLocation();
+dumpTabs();
+tabbedLocation.appendView(views[3]);
+dumpTabs();
+createTabbedLocation();
+dumpTabs();
+TestRunner.addResult('Closing second tab');
+tabbedLocation.tabbedPane().closeTab('second');
+dumpTabs();
+createTabbedLocation();
+dumpTabs();
+TestRunner.completeTest();
+
+function createTabbedLocation() {
+ TestRunner.addResult('Creating new TabbedLocation');
+ if (tabbedLocation)
+ tabbedLocation.tabbedPane().detach(true);
+ tabbedLocation = new UI.ViewManager._TabbedLocation(new MockViewManager(), undefined, 'mock-location', true, true);
+ tabbedLocation.widget().show(UI.inspectorView.element);
+}
+
+function dumpTabs() {
+ TestRunner.addResult(JSON.stringify(tabbedLocation.tabbedPane().tabIds()));
+}

Powered by Google App Engine
This is Rietveld 408576698