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

Unified Diff: third_party/WebKit/Source/devtools/front_end/main/Main.js

Issue 2975523002: DevTools: add console test helpers to new test runner & migrate a console test (Closed)
Patch Set: fix Created 3 years, 5 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/main/Main.js
diff --git a/third_party/WebKit/Source/devtools/front_end/main/Main.js b/third_party/WebKit/Source/devtools/front_end/main/Main.js
index 33288ac93ae0fddf06596522c7f5d36fc17ad0a5..03187bae5b69a5ebe337bed538d01830ef60d117 100644
--- a/third_party/WebKit/Source/devtools/front_end/main/Main.js
+++ b/third_party/WebKit/Source/devtools/front_end/main/Main.js
@@ -586,80 +586,6 @@ Main.Main.SearchActionDelegate = class {
}
};
-
-/**
- * @implements {UI.ToolbarItem.Provider}
- * @unrestricted
- */
-Main.Main.WarningErrorCounter = class {
- constructor() {
- Main.Main.WarningErrorCounter._instanceForTest = this;
-
- this._counter = createElement('div');
- this._counter.addEventListener('click', Common.console.show.bind(Common.console), false);
- this._toolbarItem = new UI.ToolbarItem(this._counter);
- var shadowRoot = UI.createShadowRootWithCoreStyles(this._counter, 'main/errorWarningCounter.css');
-
- this._errors = this._createItem(shadowRoot, 'smallicon-error');
- this._warnings = this._createItem(shadowRoot, 'smallicon-warning');
- this._titles = [];
-
- ConsoleModel.consoleModel.addEventListener(ConsoleModel.ConsoleModel.Events.ConsoleCleared, this._update, this);
- ConsoleModel.consoleModel.addEventListener(ConsoleModel.ConsoleModel.Events.MessageAdded, this._update, this);
- ConsoleModel.consoleModel.addEventListener(ConsoleModel.ConsoleModel.Events.MessageUpdated, this._update, this);
- this._update();
- }
-
- /**
- * @param {!Node} shadowRoot
- * @param {string} iconType
- * @return {!{item: !Element, text: !Element}}
- */
- _createItem(shadowRoot, iconType) {
- var item = createElementWithClass('span', 'counter-item');
- var icon = item.createChild('label', '', 'dt-icon-label');
- icon.type = iconType;
- var text = icon.createChild('span');
- shadowRoot.appendChild(item);
- return {item: item, text: text};
- }
-
- /**
- * @param {!{item: !Element, text: !Element}} item
- * @param {number} count
- * @param {boolean} first
- * @param {string} title
- */
- _updateItem(item, count, first, title) {
- item.item.classList.toggle('hidden', !count);
- item.item.classList.toggle('counter-item-first', first);
- item.text.textContent = count;
- if (count)
- this._titles.push(title);
- }
-
- _update() {
- var errors = ConsoleModel.consoleModel.errors();
- var warnings = ConsoleModel.consoleModel.warnings();
-
- this._titles = [];
- this._toolbarItem.setVisible(!!(errors || warnings));
- this._updateItem(this._errors, errors, false, Common.UIString(errors === 1 ? '%d error' : '%d errors', errors));
- this._updateItem(
- this._warnings, warnings, !errors, Common.UIString(warnings === 1 ? '%d warning' : '%d warnings', warnings));
- this._counter.title = this._titles.join(', ');
- UI.inspectorView.toolbarItemResized();
- }
-
- /**
- * @override
- * @return {?UI.ToolbarItem}
- */
- item() {
- return this._toolbarItem;
- }
-};
-
/**
* @implements {UI.ToolbarItem.Provider}
*/

Powered by Google App Engine
This is Rietveld 408576698