| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Include test fixture. | 5 // Include test fixture. |
| 6 GEN_INCLUDE(['net_internals_test.js']); | 6 GEN_INCLUDE(['net_internals_test.js']); |
| 7 | 7 |
| 8 // Anonymous namespace | 8 // Anonymous namespace |
| 9 (function() { | 9 (function() { |
| 10 | 10 |
| 11 // @return {Array.<object>} List of events for an abbreviated URL request. | 11 // @return {Array<object>} List of events for an abbreviated URL request. |
| 12 function urlRequestEvents(id) { | 12 function urlRequestEvents(id) { |
| 13 return [ | 13 return [ |
| 14 { | 14 { |
| 15 'phase': EventPhase.PHASE_BEGIN, | 15 'phase': EventPhase.PHASE_BEGIN, |
| 16 'source': { | 16 'source': { |
| 17 'id': id, | 17 'id': id, |
| 18 'type': EventSourceType.URL_REQUEST | 18 'type': EventSourceType.URL_REQUEST |
| 19 }, | 19 }, |
| 20 'time': '953534778', | 20 'time': '953534778', |
| 21 'type': EventType.REQUEST_ALIVE | 21 'type': EventType.REQUEST_ALIVE |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 } | 95 } |
| 96 ]; | 96 ]; |
| 97 } | 97 } |
| 98 | 98 |
| 99 /** | 99 /** |
| 100 * Tests the filters, both in terms of filtering correctly and UI. | 100 * Tests the filters, both in terms of filtering correctly and UI. |
| 101 */ | 101 */ |
| 102 TEST_F('NetInternalsTest', 'netInternalsEventsViewFilter', function() { | 102 TEST_F('NetInternalsTest', 'netInternalsEventsViewFilter', function() { |
| 103 // Sets the filter and checks the results. | 103 // Sets the filter and checks the results. |
| 104 // @param {string} filter Filter to use. | 104 // @param {string} filter Filter to use. |
| 105 // @param {Array.<boolean>} matches Ordered list of whether or not each source | 105 // @param {Array<boolean>} matches Ordered list of whether or not each source |
| 106 // matches |filter|. Order must match display order after applying the | 106 // matches |filter|. Order must match display order after applying the |
| 107 // filter. | 107 // filter. |
| 108 function checkFilter(filter, matches) { | 108 function checkFilter(filter, matches) { |
| 109 EventsView.getInstance().setFilterText_(filter); | 109 EventsView.getInstance().setFilterText_(filter); |
| 110 | 110 |
| 111 var postFilter = 0; | 111 var postFilter = 0; |
| 112 for (var i = 0; i < matches.length; ++i) { | 112 for (var i = 0; i < matches.length; ++i) { |
| 113 if (matches[i]) | 113 if (matches[i]) |
| 114 ++postFilter; | 114 ++postFilter; |
| 115 } | 115 } |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 $(EventsView.SORT_BY_SOURCE_TYPE_ID).click(); | 240 $(EventsView.SORT_BY_SOURCE_TYPE_ID).click(); |
| 241 expectEquals('sort:source text', eventsView.getFilterText_()); | 241 expectEquals('sort:source text', eventsView.getFilterText_()); |
| 242 eventsView.setFilterText_('text sort:id "more text"'); | 242 eventsView.setFilterText_('text sort:id "more text"'); |
| 243 $(EventsView.SORT_BY_ID_ID).click(); | 243 $(EventsView.SORT_BY_ID_ID).click(); |
| 244 expectEquals('-sort:id text "more text"', eventsView.getFilterText_()); | 244 expectEquals('-sort:id text "more text"', eventsView.getFilterText_()); |
| 245 | 245 |
| 246 testDone(); | 246 testDone(); |
| 247 }); | 247 }); |
| 248 | 248 |
| 249 })(); // Anonymous namespace | 249 })(); // Anonymous namespace |
| OLD | NEW |