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

Side by Side Diff: chrome/test/data/webui/settings/settings_ui_browsertest.js

Issue 2905393002: MD Settings: URL encode text queries before adding them to the URL. (Closed)
Patch Set: Nit. Created 3 years, 6 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 /** @fileoverview Suite of tests for the Settings layout. */ 5 /** @fileoverview Suite of tests for the Settings layout. */
6 6
7 GEN_INCLUDE(['settings_page_browsertest.js']); 7 GEN_INCLUDE(['settings_page_browsertest.js']);
8 8
9 /** 9 /**
10 * @constructor 10 * @constructor
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 126
127 settings.navigateTo( 127 settings.navigateTo(
128 settings.Route.BASIC, /* dynamicParams */ null, 128 settings.Route.BASIC, /* dynamicParams */ null,
129 /* removeSearch */ true); 129 /* removeSearch */ true);
130 assertEquals('', searchField.getSearchInput().value); 130 assertEquals('', searchField.getSearchInput().value);
131 assertFalse(settings.getQueryParameters().has('search')); 131 assertFalse(settings.getQueryParameters().has('search'));
132 132
133 var value = 'GOOG'; 133 var value = 'GOOG';
134 searchField.setValue(value); 134 searchField.setValue(value);
135 assertEquals(value, settings.getQueryParameters().get('search')); 135 assertEquals(value, settings.getQueryParameters().get('search'));
136
137 // Test that search queries are properly URL encoded.
138 value = '+++';
139 searchField.setValue(value);
dschuyler 2017/05/27 01:32:13 wdyt of asserting that the internal value of searc
dpapad 2017/05/27 01:39:34 That would not be correct (the internal value DOES
dschuyler 2017/05/27 01:44:18 Acknowledged.
140 assertEquals(value, settings.getQueryParameters().get('search'));
dpapad 2017/05/27 00:18:10 I verified that this test would have caught the pr
136 }); 141 });
137 142
138 test('whitespace only search query is ignored', function() { 143 test('whitespace only search query is ignored', function() {
139 toolbar = /** @type {!CrToolbarElement} */ (ui.$$('cr-toolbar')); 144 toolbar = /** @type {!CrToolbarElement} */ (ui.$$('cr-toolbar'));
140 var searchField = /** @type {CrToolbarSearchFieldElement} */ ( 145 var searchField = /** @type {CrToolbarSearchFieldElement} */ (
141 toolbar.getSearchField()); 146 toolbar.getSearchField());
142 searchField.setValue(' '); 147 searchField.setValue(' ');
143 var urlParams = settings.getQueryParameters(); 148 var urlParams = settings.getQueryParameters();
144 assertFalse(urlParams.has('search')); 149 assertFalse(urlParams.has('search'));
145 150
146 searchField.setValue(' foo'); 151 searchField.setValue(' foo');
147 urlParams = settings.getQueryParameters(); 152 urlParams = settings.getQueryParameters();
148 assertEquals('foo', urlParams.get('search')); 153 assertEquals('foo', urlParams.get('search'));
149 154
150 searchField.setValue(' foo '); 155 searchField.setValue(' foo ');
151 urlParams = settings.getQueryParameters(); 156 urlParams = settings.getQueryParameters();
152 assertEquals('foo ', urlParams.get('search')); 157 assertEquals('foo ', urlParams.get('search'));
153 158
154 searchField.setValue(' '); 159 searchField.setValue(' ');
155 urlParams = settings.getQueryParameters(); 160 urlParams = settings.getQueryParameters();
156 assertFalse(urlParams.has('search')); 161 assertFalse(urlParams.has('search'));
157 }); 162 });
158 }); 163 });
159 164
160 mocha.run(); 165 mocha.run();
161 }); 166 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698