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..54d5a8b62ae3b5641132784f869bdac5479c63c3 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector-unit/view-location.js |
@@ -0,0 +1,58 @@ |
+class ClosableView extends UI.SimpleView { |
+ isCloseable() { |
+ return true; |
+ } |
+} |
+ |
+runtime._registerModule({ |
+ name: "mock-module", |
+ extensions: ['first', 'second', 'third', 'fourth'].map(title => { |
+ return { |
+ "type": "view", |
+ "location": "mock-location", |
+ "id": title, |
+ "title": title, |
+ "persistence": "closeable", |
dgozman
2017/05/26 19:17:08
Do you need both this and isCloseable method? In f
einbinder
2017/05/26 21:12:38
I did but now I don't.
|
+ "factoryName": "ClosableView" |
+ } |
+ }), |
+ scripts: [] |
+}); |
+ |
+var tabbedLocation; |
+createTabbedLocation(); |
+dumpTabs(); |
+TestRunner.addResult('Appending three views') |
+tabbedLocation.appendView(new ClosableView('first')); |
dgozman
2017/05/26 19:17:08
Why manually? Doesn't this clash with ones from ex
einbinder
2017/05/26 21:12:38
It doesn't clash, but your code is much cleaner.
|
+tabbedLocation.appendView(new ClosableView('second')); |
+tabbedLocation.appendView(new ClosableView('third')); |
+dumpTabs(); |
+createTabbedLocation(); |
+dumpTabs(); |
+TestRunner.addResult('Re-order tabs'); |
+tabbedLocation.tabbedPane()._insertBefore(tabbedLocation.tabbedPane()._tabsById.get("third"), 0); |
+dumpTabs(); |
+createTabbedLocation(); |
+dumpTabs(); |
+tabbedLocation.appendView(new ClosableView('fourth')); |
+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()).createTabbedLocation(undefined, 'mock-location', true, true); |
dgozman
2017/05/26 19:17:08
Why not UI.viewManager?
einbinder
2017/05/26 21:12:39
UI.viewManager has stale extensions. Also it shoul
|
+ tabbedLocation.widget().show(UI.inspectorView.element); |
+} |
+ |
+function dumpTabs() { |
+ TestRunner.addResult(JSON.stringify(tabbedLocation.tabbedPane().tabIds())); |
+} |