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

Unified Diff: third_party/WebKit/Source/devtools/front_end/Tests.js

Issue 2297443002: DevTools: show extension name in console execution context selector. (Closed)
Patch Set: Created 4 years, 4 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/Source/devtools/front_end/Tests.js
diff --git a/third_party/WebKit/Source/devtools/front_end/Tests.js b/third_party/WebKit/Source/devtools/front_end/Tests.js
index d78c776ea6a5df58ef12898b611e3615346325fc..4ac330f5240967600ddbb4064e084c6ec658fabf 100644
--- a/third_party/WebKit/Source/devtools/front_end/Tests.js
+++ b/third_party/WebKit/Source/devtools/front_end/Tests.js
@@ -922,6 +922,25 @@ TestSuite.prototype.testWindowInitializedOnNavigateBack = function()
this.fail(text);
};
+TestSuite.prototype.testConsoleContextNames = function()
+{
+ var test = this;
+ test.takeControl();
+ this.showPanel("console").then(() => this._waitForExecutionContexts(2, onExecutionContexts.bind(this)));
+
+ function onExecutionContexts()
+ {
+ var consoleView = WebInspector.ConsoleView.instance();
+ var options = consoleView._consoleContextSelector._selectElement.options;
+ var values = [];
+ for (var i = 0; i < options.length; ++i)
+ values.push(options[i].value.trim());
+ test.assertEquals("top", values[0]);
+ test.assertEquals("Simple content script", values[1]);
+ test.releaseControl();
+ }
+}
+
TestSuite.prototype.waitForTestResultsInConsole = function()
{
var messages = WebInspector.multitargetConsoleModel.messages();
@@ -1176,6 +1195,20 @@ TestSuite.prototype._waitForTargets = function(n, callback)
}
}
+TestSuite.prototype._waitForExecutionContexts = function(n, callback)
+{
+ var runtimeModel = WebInspector.targetManager.mainTarget().runtimeModel;
+ checkForExecutionContexts.call(this);
+
+ function checkForExecutionContexts()
+ {
+ if (runtimeModel.executionContexts().length >= n)
+ callback.call(null);
+ else
+ this.addSniffer(WebInspector.RuntimeModel.prototype, "_executionContextCreated", checkForExecutionContexts.bind(this));
+ }
+}
+
/**
* Key event with given key identifier.
*/

Powered by Google App Engine
This is Rietveld 408576698