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

Side by Side Diff: LayoutTests/inspector/styles/styles-test.js

Issue 148523012: DevTools: [CSS] remove getAllStylesheets method from protocol (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 function initialize_StylesTests()
2 {
3
4 InspectorTest.waitForStylesheetsOnFrontend = function(styleSheetsAmount, callbac k)
apavlov 2014/01/29 14:08:57 |styleSheetsCount| will sound more common here
lushnikov 2014/01/29 18:21:46 Done.
5 {
6 function styleSheetComparator(a, b)
7 {
8 if (a.sourceURL < b.sourceURL)
apavlov 2014/01/29 14:08:57 This can be written as: return a.sourceURL.locale
lushnikov 2014/01/29 18:21:46 Left as-is due to discussion offline
9 return -1;
10 else if (a.sourceURL > b.sourceURL)
11 return 1;
12 return a.startLine - b.startLine || a.startColumn - b.startColumn;
13 }
14
15 var styleSheets = WebInspector.cssModel.allStyleSheets();
16 if (styleSheets.length >= styleSheetsAmount) {
17 styleSheets.sort(styleSheetComparator);
18 callback(styleSheets);
19 return;
20 }
21
22 function onStyleSheetAdded()
23 {
24 var styleSheets = WebInspector.cssModel.allStyleSheets();
25 if (styleSheets.length < styleSheetsAmount)
26 return;
27
28 WebInspector.cssModel.removeEventListener(WebInspector.CSSStyleModel.Eve nts.StyleSheetAdded, onStyleSheetAdded, this);
29 styleSheets.sort(styleSheetComparator);
30 callback(null, styleSheets);
31 }
32
33 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Sty leSheetAdded, onStyleSheetAdded, this);
34 }
35
36 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698