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

Side by Side Diff: chrome/test/data/webui/net_internals/log_util.js

Issue 10332238: net-internals: Fix cookies not being hidden, when saving after capturing is stopped (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Oops Created 8 years, 7 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
« no previous file with comments | « chrome/browser/resources/net_internals/main.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /** 5 /**
6 * @fileoverview This file contains tests for creating and loading log files. 6 * @fileoverview This file contains tests for creating and loading log files.
7 * It also tests the stop capturing button, since it both creates and then loads 7 * It also tests the stop capturing button, since it both creates and then loads
8 * a log dump. 8 * a log dump.
9 */ 9 */
10 10
(...skipping 19 matching lines...) Expand all
30 30
31 CreateAndLoadLogTask.prototype = { 31 CreateAndLoadLogTask.prototype = {
32 __proto__: NetInternalsTest.Task.prototype, 32 __proto__: NetInternalsTest.Task.prototype,
33 33
34 /** 34 /**
35 * Start creating the log dump. Use ExportView's function as it supports 35 * Start creating the log dump. Use ExportView's function as it supports
36 * both creating completely new logs and using existing logs to create new 36 * both creating completely new logs and using existing logs to create new
37 * ones, depending on whether or not we're currently viewing a log. 37 * ones, depending on whether or not we're currently viewing a log.
38 */ 38 */
39 start: function() { 39 start: function() {
40 this.initialSecurityStripping_ =
41 SourceTracker.getInstance().getSecurityStripping();
40 $(ExportView.USER_COMMENTS_TEXT_AREA_ID).value = this.userComments_; 42 $(ExportView.USER_COMMENTS_TEXT_AREA_ID).value = this.userComments_;
41 ExportView.getInstance().createLogDump_(this.onLogDumpCreated.bind(this), 43 ExportView.getInstance().createLogDump_(this.onLogDumpCreated.bind(this),
42 true); 44 true);
43 }, 45 },
44 46
45 /** 47 /**
46 * Callback passed to |createLogDumpAsync|. Tries to load the dumped log 48 * Callback passed to |createLogDumpAsync|. Tries to load the dumped log
47 * text. Checks the status bar and user comments after loading the log. 49 * text. Checks the status bar and user comments after loading the log.
48 * @param {string} logDumpText Log dump, as a string. 50 * @param {string} logDumpText Log dump, as a string.
49 */ 51 */
50 onLogDumpCreated: function(logDumpText) { 52 onLogDumpCreated: function(logDumpText) {
53 expectEquals(this.initialSecurityStripping_,
54 SourceTracker.getInstance().getSecurityStripping());
51 expectEquals('Log loaded.', log_util.loadLogFile(logDumpText, 'log.txt')); 55 expectEquals('Log loaded.', log_util.loadLogFile(logDumpText, 'log.txt'));
56 expectFalse(SourceTracker.getInstance().getSecurityStripping());
52 57
53 NetInternalsTest.expectStatusViewNodeVisible(LoadedStatusView.MAIN_BOX_ID); 58 NetInternalsTest.expectStatusViewNodeVisible(LoadedStatusView.MAIN_BOX_ID);
54 59
55 expectEquals(this.userComments_, 60 expectEquals(this.userComments_,
56 $(ExportView.USER_COMMENTS_TEXT_AREA_ID).value); 61 $(ExportView.USER_COMMENTS_TEXT_AREA_ID).value);
57 // Make sure the DIV on the import tab containing the comments is visible 62 // Make sure the DIV on the import tab containing the comments is visible
58 // before checking the displayed text. 63 // before checking the displayed text.
59 expectTrue(NetInternalsTest.nodeIsVisible($(ImportView.LOADED_DIV_ID))); 64 expectTrue(NetInternalsTest.nodeIsVisible($(ImportView.LOADED_DIV_ID)));
60 expectEquals(this.userComments_, 65 expectEquals(this.userComments_,
61 $(ImportView.LOADED_INFO_USER_COMMENTS_ID).innerText); 66 $(ImportView.LOADED_INFO_USER_COMMENTS_ID).innerText);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 serviceProviders: cr.isWindows, 118 serviceProviders: cr.isWindows,
114 tests: false, 119 tests: false,
115 hsts: false, 120 hsts: false,
116 logs: false, 121 logs: false,
117 prerender: true, 122 prerender: true,
118 chromeos: false 123 chromeos: false
119 }; 124 };
120 NetInternalsTest.checkTabHandleVisibility(tabVisibilityState, false); 125 NetInternalsTest.checkTabHandleVisibility(tabVisibilityState, false);
121 } 126 }
122 127
128 function checkSecurityStripping(expectedValue) {
129 expectEquals(expectedValue,
130 SourceTracker.getInstance().getSecurityStripping());
131 }
132
123 /** 133 /**
124 * Exports a log dump to a string and loads it. Makes sure no errors occur, 134 * Exports a log dump to a string and loads it. Makes sure no errors occur,
125 * and checks visibility of tabs aftwards. Does not actually save the log to a 135 * and checks visibility of tabs aftwards. Does not actually save the log to a
126 * file. 136 * file.
127 * TODO(mmenke): Add some checks for the import view. 137 * TODO(mmenke): Add some checks for the import view.
128 * TODO(mmenke): Add a test for a log created with --log-net-log. 138 * TODO(mmenke): Add a test for a log created with --log-net-log.
129 */ 139 */
130 TEST_F('NetInternalsTest', 'netInternalsExportImportDump', function() { 140 TEST_F('NetInternalsTest', 'netInternalsExportImportDump', function() {
131 expectFalse(g_browser.isDisabled()); 141 expectFalse(g_browser.isDisabled());
142 expectTrue(SourceTracker.getInstance().getSecurityStripping());
132 NetInternalsTest.expectStatusViewNodeVisible(CaptureStatusView.MAIN_BOX_ID); 143 NetInternalsTest.expectStatusViewNodeVisible(CaptureStatusView.MAIN_BOX_ID);
133 144
134 var taskQueue = new NetInternalsTest.TaskQueue(true); 145 var taskQueue = new NetInternalsTest.TaskQueue(true);
135 taskQueue.addTask(new CreateAndLoadLogTask('Detailed explanation.')); 146 taskQueue.addTask(new CreateAndLoadLogTask('Detailed explanation.'));
136 taskQueue.addFunctionTask(checkViewsAfterLogLoaded); 147 taskQueue.addFunctionTask(checkViewsAfterLogLoaded);
137 taskQueue.run(true); 148 taskQueue.run(true);
138 }); 149 });
139 150
140 /** 151 /**
141 * Exports a log dump to a string and loads it, and then repeats, making sure 152 * Exports a log dump to a string and loads it, and then repeats, making sure
(...skipping 14 matching lines...) Expand all
156 TEST_F('NetInternalsTest', 'netInternalsStopCapturing', function() { 167 TEST_F('NetInternalsTest', 'netInternalsStopCapturing', function() {
157 var taskQueue = new NetInternalsTest.TaskQueue(true); 168 var taskQueue = new NetInternalsTest.TaskQueue(true);
158 // Switching to stop capturing mode will load a log dump, which will update 169 // Switching to stop capturing mode will load a log dump, which will update
159 // the constants. 170 // the constants.
160 taskQueue.addTask(new WaitForConstantsTask()); 171 taskQueue.addTask(new WaitForConstantsTask());
161 172
162 taskQueue.addFunctionTask( 173 taskQueue.addFunctionTask(
163 NetInternalsTest.expectStatusViewNodeVisible.bind( 174 NetInternalsTest.expectStatusViewNodeVisible.bind(
164 null, HaltedStatusView.MAIN_BOX_ID)); 175 null, HaltedStatusView.MAIN_BOX_ID));
165 taskQueue.addFunctionTask(checkViewsAfterLogLoaded); 176 taskQueue.addFunctionTask(checkViewsAfterLogLoaded);
177 taskQueue.addFunctionTask(checkSecurityStripping.bind(null, true));
166 taskQueue.run(); 178 taskQueue.run();
167 179
168 // Simulate a click on the stop capturing button. 180 // Simulate a click on the stop capturing button.
169 $(CaptureStatusView.STOP_BUTTON_ID).click(); 181 $(CaptureStatusView.STOP_BUTTON_ID).click();
170 }); 182 });
171 183
172 /** 184 /**
173 * Switches to stop capturing mode, then exports and imports a log dump. 185 * Switches to stop capturing mode, then exports and imports a log dump.
174 */ 186 */
175 TEST_F('NetInternalsTest', 'netInternalsStopCapturingExportImport', function() { 187 TEST_F('NetInternalsTest', 'netInternalsStopCapturingExportImport', function() {
176 var taskQueue = new NetInternalsTest.TaskQueue(true); 188 var taskQueue = new NetInternalsTest.TaskQueue(true);
177 // Switching to stop capturing mode will load a log dump, which will update 189 // Switching to stop capturing mode will load a log dump, which will update
178 // the constants. 190 // the constants.
179 taskQueue.addTask(new WaitForConstantsTask()); 191 taskQueue.addTask(new WaitForConstantsTask());
180 192
181 taskQueue.addFunctionTask( 193 taskQueue.addFunctionTask(
182 NetInternalsTest.expectStatusViewNodeVisible.bind( 194 NetInternalsTest.expectStatusViewNodeVisible.bind(
183 null, HaltedStatusView.MAIN_BOX_ID)); 195 null, HaltedStatusView.MAIN_BOX_ID));
184 taskQueue.addFunctionTask(checkViewsAfterLogLoaded); 196 taskQueue.addFunctionTask(checkViewsAfterLogLoaded);
197 taskQueue.addFunctionTask(checkSecurityStripping.bind(null, true));
185 taskQueue.addTask(new CreateAndLoadLogTask('Detailed explanation.')); 198 taskQueue.addTask(new CreateAndLoadLogTask('Detailed explanation.'));
186 taskQueue.addFunctionTask(checkViewsAfterLogLoaded); 199 taskQueue.addFunctionTask(checkViewsAfterLogLoaded);
187 taskQueue.run(); 200 taskQueue.run();
188 201
189 // Simulate a click on the stop capturing button. 202 // Simulate a click on the stop capturing button.
190 $(CaptureStatusView.STOP_BUTTON_ID).click(); 203 $(CaptureStatusView.STOP_BUTTON_ID).click();
191 }); 204 });
192 205
193 })(); // Anonymous namespace 206 })(); // Anonymous namespace
OLDNEW
« no previous file with comments | « chrome/browser/resources/net_internals/main.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698