| 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 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 /** | 33 /** |
| 34 * A Task that waits for the results of an HSTS query. Once the results are | 34 * A Task that waits for the results of an HSTS query. Once the results are |
| 35 * received, checks them before completing. Does not initiate the query. | 35 * received, checks them before completing. Does not initiate the query. |
| 36 * @param {string} domain The domain expected in the returned results. | 36 * @param {string} domain The domain expected in the returned results. |
| 37 * @param {bool} stsSubdomains Whether or not the stsSubdomains flag is expected | 37 * @param {bool} stsSubdomains Whether or not the stsSubdomains flag is expected |
| 38 * to be set in the returned results. Ignored on error and not found | 38 * to be set in the returned results. Ignored on error and not found |
| 39 * results. | 39 * results. |
| 40 * @param {bool} pkpSubdomains Whether or not the pkpSubdomains flag is expected | 40 * @param {bool} pkpSubdomains Whether or not the pkpSubdomains flag is expected |
| 41 * to be set in the returned results. Ignored on error and not found | 41 * to be set in the returned results. Ignored on error and not found |
| 42 * results. | 42 * results. |
| 43 * @param {number} stsObserved The time the STS policy was observed. |
| 44 * @param {number} pkpObserved The time the PKP policy was observed. |
| 43 * @param {string} publicKeyHashes Expected public key hashes. Ignored on error | 45 * @param {string} publicKeyHashes Expected public key hashes. Ignored on error |
| 44 * error and not found results. | 46 * error and not found results. |
| 45 * @param {QueryResultType} queryResultType The expected result type of the | 47 * @param {QueryResultType} queryResultType The expected result type of the |
| 46 * results of the query. | 48 * results of the query. |
| 47 * @extends {NetInternalsTest.Task} | 49 * @extends {NetInternalsTest.Task} |
| 48 */ | 50 */ |
| 49 function CheckQueryResultTask(domain, stsSubdomains, pkpSubdomains, | 51 function CheckQueryResultTask(domain, stsSubdomains, pkpSubdomains, |
| 50 publicKeyHashes, queryResultType) { | 52 stsObserved, pkpObserved, publicKeyHashes, |
| 53 queryResultType) { |
| 51 this.domain_ = domain; | 54 this.domain_ = domain; |
| 52 this.stsSubdomains_ = stsSubdomains; | 55 this.stsSubdomains_ = stsSubdomains; |
| 53 this.pkpSubdomains_ = pkpSubdomains; | 56 this.pkpSubdomains_ = pkpSubdomains; |
| 57 this.stsObserved_ = stsObserved; |
| 58 this.pkpObserved_ = pkpObserved; |
| 54 this.publicKeyHashes_ = publicKeyHashes; | 59 this.publicKeyHashes_ = publicKeyHashes; |
| 55 this.queryResultType_ = queryResultType; | 60 this.queryResultType_ = queryResultType; |
| 56 NetInternalsTest.Task.call(this); | 61 NetInternalsTest.Task.call(this); |
| 57 } | 62 } |
| 58 | 63 |
| 59 CheckQueryResultTask.prototype = { | 64 CheckQueryResultTask.prototype = { |
| 60 __proto__: NetInternalsTest.Task.prototype, | 65 __proto__: NetInternalsTest.Task.prototype, |
| 61 | 66 |
| 62 /** | 67 /** |
| 63 * Starts watching for the query results. | 68 * Starts watching for the query results. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 }, | 117 }, |
| 113 | 118 |
| 114 /** | 119 /** |
| 115 * Checks successful results. | 120 * Checks successful results. |
| 116 * @param {object} result Results from the query. | 121 * @param {object} result Results from the query. |
| 117 */ | 122 */ |
| 118 checkSuccess_: function(result) { | 123 checkSuccess_: function(result) { |
| 119 expectEquals(QueryResultType.SUCCESS, this.queryResultType_); | 124 expectEquals(QueryResultType.SUCCESS, this.queryResultType_); |
| 120 expectEquals(this.stsSubdomains_, result.sts_subdomains); | 125 expectEquals(this.stsSubdomains_, result.sts_subdomains); |
| 121 expectEquals(this.pkpSubdomains_, result.pkp_subdomains); | 126 expectEquals(this.pkpSubdomains_, result.pkp_subdomains); |
| 127 expectLE(this.stsObserved_, result.sts_observed); |
| 128 expectLE(this.pkpObserved_, result.pkp_observed); |
| 122 | 129 |
| 123 // |public_key_hashes| is an old synonym for what is now | 130 // |public_key_hashes| is an old synonym for what is now |
| 124 // |preloaded_spki_hashes|, which in turn is a legacy synonym for | 131 // |preloaded_spki_hashes|, which in turn is a legacy synonym for |
| 125 // |static_spki_hashes|. Look for all three, and also for | 132 // |static_spki_hashes|. Look for all three, and also for |
| 126 // |dynamic_spki_hashes|. | 133 // |dynamic_spki_hashes|. |
| 127 if (typeof result.public_key_hashes === 'undefined') | 134 if (typeof result.public_key_hashes === 'undefined') |
| 128 result.public_key_hashes = ''; | 135 result.public_key_hashes = ''; |
| 129 if (typeof result.preloaded_spki_hashes === 'undefined') | 136 if (typeof result.preloaded_spki_hashes === 'undefined') |
| 130 result.preloaded_spki_hashes = ''; | 137 result.preloaded_spki_hashes = ''; |
| 131 if (typeof result.static_spki_hashes === 'undefined') | 138 if (typeof result.static_spki_hashes === 'undefined') |
| (...skipping 23 matching lines...) Expand all Loading... |
| 155 * A Task to try and add an HSTS domain via the HTML form. The task will wait | 162 * A Task to try and add an HSTS domain via the HTML form. The task will wait |
| 156 * until the results from the automatically sent query have been received, and | 163 * until the results from the automatically sent query have been received, and |
| 157 * then checks them against the expected values. | 164 * then checks them against the expected values. |
| 158 * @param {string} domain The domain to send and expected to be returned. | 165 * @param {string} domain The domain to send and expected to be returned. |
| 159 * @param {bool} stsSubdomains Whether the HSTS subdomain checkbox should be | 166 * @param {bool} stsSubdomains Whether the HSTS subdomain checkbox should be |
| 160 * selected. Also the corresponding expected return value, in the success | 167 * selected. Also the corresponding expected return value, in the success |
| 161 * case. | 168 * case. |
| 162 * @param {bool} pkpSubdomains Whether the pinning subdomain checkbox should be | 169 * @param {bool} pkpSubdomains Whether the pinning subdomain checkbox should be |
| 163 * selected. Also the corresponding expected return value, in the success | 170 * selected. Also the corresponding expected return value, in the success |
| 164 * case. | 171 * case. |
| 172 * @param {number} stsObserved The time the STS policy was observed. |
| 173 * @param {number} pkpObserved The time the PKP policy was observed. |
| 165 * @param {string} publicKeyHashes Public key hash to send. Also the | 174 * @param {string} publicKeyHashes Public key hash to send. Also the |
| 166 * corresponding expected return value, on success. When this is the string | 175 * corresponding expected return value, on success. When this is the string |
| 167 * INVALID_HASH, an empty string is expected to be received instead. | 176 * INVALID_HASH, an empty string is expected to be received instead. |
| 168 * @param {QueryResultType} queryResultType Expected result type. | 177 * @param {QueryResultType} queryResultType Expected result type. |
| 169 * @extends {CheckQueryResultTask} | 178 * @extends {CheckQueryResultTask} |
| 170 */ | 179 */ |
| 171 function AddTask(domain, stsSubdomains, pkpSubdomains, publicKeyHashes, | 180 function AddTask(domain, stsSubdomains, pkpSubdomains, publicKeyHashes, |
| 172 queryResultType) { | 181 stsObserved, pkpObserved, queryResultType) { |
| 173 this.requestedPublicKeyHashes_ = publicKeyHashes; | 182 this.requestedPublicKeyHashes_ = publicKeyHashes; |
| 174 if (publicKeyHashes == INVALID_HASH) | 183 if (publicKeyHashes == INVALID_HASH) |
| 175 publicKeyHashes = ''; | 184 publicKeyHashes = ''; |
| 176 CheckQueryResultTask.call(this, domain, stsSubdomains, pkpSubdomains, | 185 CheckQueryResultTask.call(this, domain, stsSubdomains, pkpSubdomains, |
| 177 publicKeyHashes, queryResultType); | 186 stsObserved, pkpObserved, publicKeyHashes, |
| 187 queryResultType); |
| 178 } | 188 } |
| 179 | 189 |
| 180 AddTask.prototype = { | 190 AddTask.prototype = { |
| 181 __proto__: CheckQueryResultTask.prototype, | 191 __proto__: CheckQueryResultTask.prototype, |
| 182 | 192 |
| 183 /** | 193 /** |
| 184 * Fills out the add form, simulates a click to submit it, and starts | 194 * Fills out the add form, simulates a click to submit it, and starts |
| 185 * listening for the results of the query that is automatically submitted. | 195 * listening for the results of the query that is automatically submitted. |
| 186 */ | 196 */ |
| 187 start: function() { | 197 start: function() { |
| 188 $(HSTSView.ADD_INPUT_ID).value = this.domain_; | 198 $(HSTSView.ADD_INPUT_ID).value = this.domain_; |
| 189 $(HSTSView.ADD_STS_CHECK_ID).checked = this.stsSubdomains_; | 199 $(HSTSView.ADD_STS_CHECK_ID).checked = this.stsSubdomains_; |
| 190 $(HSTSView.ADD_PKP_CHECK_ID).checked = this.pkpSubdomains_; | 200 $(HSTSView.ADD_PKP_CHECK_ID).checked = this.pkpSubdomains_; |
| 191 $(HSTSView.ADD_PINS_ID).value = this.requestedPublicKeyHashes_; | 201 $(HSTSView.ADD_PINS_ID).value = this.requestedPublicKeyHashes_; |
| 192 $(HSTSView.ADD_SUBMIT_ID).click(); | 202 $(HSTSView.ADD_SUBMIT_ID).click(); |
| 193 CheckQueryResultTask.prototype.start.call(this); | 203 CheckQueryResultTask.prototype.start.call(this); |
| 194 } | 204 } |
| 195 }; | 205 }; |
| 196 | 206 |
| 197 /** | 207 /** |
| 198 * A Task to query a domain and wait for the results. Parameters mirror those | 208 * A Task to query a domain and wait for the results. Parameters mirror those |
| 199 * of CheckQueryResultTask, except |domain| is also the name of the domain to | 209 * of CheckQueryResultTask, except |domain| is also the name of the domain to |
| 200 * query. | 210 * query. |
| 201 * @extends {CheckQueryResultTask} | 211 * @extends {CheckQueryResultTask} |
| 202 */ | 212 */ |
| 203 function QueryTask(domain, stsSubdomains, pkpSubdomains, publicKeyHashes, | 213 function QueryTask(domain, stsSubdomains, pkpSubdomains, stsObserved, |
| 204 queryResultType) { | 214 pkpObserved, publicKeyHashes, queryResultType) { |
| 205 CheckQueryResultTask.call(this, domain, stsSubdomains, pkpSubdomains, | 215 CheckQueryResultTask.call(this, domain, stsSubdomains, pkpSubdomains, |
| 206 publicKeyHashes, queryResultType); | 216 stsObserved, pkpObserved, publicKeyHashes, |
| 217 queryResultType); |
| 207 } | 218 } |
| 208 | 219 |
| 209 QueryTask.prototype = { | 220 QueryTask.prototype = { |
| 210 __proto__: CheckQueryResultTask.prototype, | 221 __proto__: CheckQueryResultTask.prototype, |
| 211 | 222 |
| 212 /** | 223 /** |
| 213 * Fills out the query form, simulates a click to submit it, and starts | 224 * Fills out the query form, simulates a click to submit it, and starts |
| 214 * listening for the results. | 225 * listening for the results. |
| 215 */ | 226 */ |
| 216 start: function() { | 227 start: function() { |
| 217 CheckQueryResultTask.prototype.start.call(this); | 228 CheckQueryResultTask.prototype.start.call(this); |
| 218 $(HSTSView.QUERY_INPUT_ID).value = this.domain_; | 229 $(HSTSView.QUERY_INPUT_ID).value = this.domain_; |
| 219 $(HSTSView.QUERY_SUBMIT_ID).click(); | 230 $(HSTSView.QUERY_SUBMIT_ID).click(); |
| 220 } | 231 } |
| 221 }; | 232 }; |
| 222 | 233 |
| 223 /** | 234 /** |
| 224 * Task that deletes a single domain, then queries the deleted domain to make | 235 * Task that deletes a single domain, then queries the deleted domain to make |
| 225 * sure it's gone. | 236 * sure it's gone. |
| 226 * @param {string} domain The domain to delete. | 237 * @param {string} domain The domain to delete. |
| 227 * @param {QueryResultType} queryResultType The result of the query. Can be | 238 * @param {QueryResultType} queryResultType The result of the query. Can be |
| 228 * QueryResultType.ERROR or QueryResultType.NOT_FOUND. | 239 * QueryResultType.ERROR or QueryResultType.NOT_FOUND. |
| 229 * @extends {QueryTask} | 240 * @extends {QueryTask} |
| 230 */ | 241 */ |
| 231 function DeleteTask(domain, queryResultType) { | 242 function DeleteTask(domain, queryResultType) { |
| 232 expectNotEquals(queryResultType, QueryResultType.SUCCESS); | 243 expectNotEquals(queryResultType, QueryResultType.SUCCESS); |
| 233 this.domain_ = domain; | 244 this.domain_ = domain; |
| 234 QueryTask.call(this, domain, false, false, '', queryResultType); | 245 QueryTask.call(this, domain, false, false, '', 0, 0, queryResultType); |
| 235 } | 246 } |
| 236 | 247 |
| 237 DeleteTask.prototype = { | 248 DeleteTask.prototype = { |
| 238 __proto__: QueryTask.prototype, | 249 __proto__: QueryTask.prototype, |
| 239 | 250 |
| 240 /** | 251 /** |
| 241 * Fills out the delete form and simulates a click to submit it. Then sends | 252 * Fills out the delete form and simulates a click to submit it. Then sends |
| 242 * a query. | 253 * a query. |
| 243 */ | 254 */ |
| 244 start: function() { | 255 start: function() { |
| 245 $(HSTSView.DELETE_INPUT_ID).value = this.domain_; | 256 $(HSTSView.DELETE_INPUT_ID).value = this.domain_; |
| 246 $(HSTSView.DELETE_SUBMIT_ID).click(); | 257 $(HSTSView.DELETE_SUBMIT_ID).click(); |
| 247 QueryTask.prototype.start.call(this); | 258 QueryTask.prototype.start.call(this); |
| 248 } | 259 } |
| 249 }; | 260 }; |
| 250 | 261 |
| 251 /** | 262 /** |
| 252 * Checks that querying a domain that was never added fails. | 263 * Checks that querying a domain that was never added fails. |
| 253 */ | 264 */ |
| 254 TEST_F('NetInternalsTest', 'netInternalsHSTSViewQueryNotFound', function() { | 265 TEST_F('NetInternalsTest', 'netInternalsHSTSViewQueryNotFound', function() { |
| 255 NetInternalsTest.switchToView('hsts'); | 266 NetInternalsTest.switchToView('hsts'); |
| 256 taskQueue = new NetInternalsTest.TaskQueue(true); | 267 taskQueue = new NetInternalsTest.TaskQueue(true); |
| 257 taskQueue.addTask(new QueryTask('somewhere.com', false, false, '', | 268 var now = new Date().getTime() / 1000.0; |
| 269 taskQueue.addTask(new QueryTask('somewhere.com', false, false, now, now, '', |
| 258 QueryResultType.NOT_FOUND)); | 270 QueryResultType.NOT_FOUND)); |
| 259 taskQueue.run(); | 271 taskQueue.run(); |
| 260 }); | 272 }); |
| 261 | 273 |
| 262 /** | 274 /** |
| 263 * Checks that querying a domain with an invalid name returns an error. | 275 * Checks that querying a domain with an invalid name returns an error. |
| 264 */ | 276 */ |
| 265 TEST_F('NetInternalsTest', 'netInternalsHSTSViewQueryError', function() { | 277 TEST_F('NetInternalsTest', 'netInternalsHSTSViewQueryError', function() { |
| 266 NetInternalsTest.switchToView('hsts'); | 278 NetInternalsTest.switchToView('hsts'); |
| 267 taskQueue = new NetInternalsTest.TaskQueue(true); | 279 taskQueue = new NetInternalsTest.TaskQueue(true); |
| 268 taskQueue.addTask(new QueryTask('\u3024', false, false, '', | 280 var now = new Date().getTime() / 1000.0; |
| 281 taskQueue.addTask(new QueryTask('\u3024', false, false, now, now, '', |
| 269 QueryResultType.ERROR)); | 282 QueryResultType.ERROR)); |
| 270 taskQueue.run(); | 283 taskQueue.run(); |
| 271 }); | 284 }); |
| 272 | 285 |
| 273 /** | 286 /** |
| 274 * Deletes a domain that was never added. | 287 * Deletes a domain that was never added. |
| 275 */ | 288 */ |
| 276 TEST_F('NetInternalsTest', 'netInternalsHSTSViewDeleteNotFound', function() { | 289 TEST_F('NetInternalsTest', 'netInternalsHSTSViewDeleteNotFound', function() { |
| 277 NetInternalsTest.switchToView('hsts'); | 290 NetInternalsTest.switchToView('hsts'); |
| 278 taskQueue = new NetInternalsTest.TaskQueue(true); | 291 taskQueue = new NetInternalsTest.TaskQueue(true); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 289 taskQueue.addTask(new DeleteTask('\u3024', QueryResultType.ERROR)); | 302 taskQueue.addTask(new DeleteTask('\u3024', QueryResultType.ERROR)); |
| 290 taskQueue.run(); | 303 taskQueue.run(); |
| 291 }); | 304 }); |
| 292 | 305 |
| 293 /** | 306 /** |
| 294 * Adds a domain and then deletes it. | 307 * Adds a domain and then deletes it. |
| 295 */ | 308 */ |
| 296 TEST_F('NetInternalsTest', 'netInternalsHSTSViewAddDelete', function() { | 309 TEST_F('NetInternalsTest', 'netInternalsHSTSViewAddDelete', function() { |
| 297 NetInternalsTest.switchToView('hsts'); | 310 NetInternalsTest.switchToView('hsts'); |
| 298 taskQueue = new NetInternalsTest.TaskQueue(true); | 311 taskQueue = new NetInternalsTest.TaskQueue(true); |
| 312 var now = new Date().getTime() / 1000.0; |
| 299 taskQueue.addTask(new AddTask('somewhere.com', false, false, VALID_HASH, | 313 taskQueue.addTask(new AddTask('somewhere.com', false, false, VALID_HASH, |
| 300 QueryResultType.SUCCESS)); | 314 now, now, QueryResultType.SUCCESS)); |
| 301 taskQueue.addTask(new DeleteTask('somewhere.com', QueryResultType.NOT_FOUND)); | 315 taskQueue.addTask(new DeleteTask('somewhere.com', QueryResultType.NOT_FOUND)); |
| 302 taskQueue.run(); | 316 taskQueue.run(); |
| 303 }); | 317 }); |
| 304 | 318 |
| 305 /** | 319 /** |
| 306 * Tries to add a domain with an invalid name. | 320 * Tries to add a domain with an invalid name. |
| 307 */ | 321 */ |
| 308 TEST_F('NetInternalsTest', 'netInternalsHSTSViewAddFail', function() { | 322 TEST_F('NetInternalsTest', 'netInternalsHSTSViewAddFail', function() { |
| 309 NetInternalsTest.switchToView('hsts'); | 323 NetInternalsTest.switchToView('hsts'); |
| 310 taskQueue = new NetInternalsTest.TaskQueue(true); | 324 taskQueue = new NetInternalsTest.TaskQueue(true); |
| 325 var now = new Date().getTime() / 1000.0; |
| 311 taskQueue.addTask(new AddTask('0123456789012345678901234567890' + | 326 taskQueue.addTask(new AddTask('0123456789012345678901234567890' + |
| 312 '012345678901234567890123456789012345', | 327 '012345678901234567890123456789012345', |
| 313 false, false, '', QueryResultType.NOT_FOUND)); | 328 false, false, '', now, now, |
| 329 QueryResultType.NOT_FOUND)); |
| 314 taskQueue.run(); | 330 taskQueue.run(); |
| 315 }); | 331 }); |
| 316 | 332 |
| 317 /** | 333 /** |
| 318 * Tries to add a domain with a name that errors out on lookup due to having | 334 * Tries to add a domain with a name that errors out on lookup due to having |
| 319 * non-ASCII characters in it. | 335 * non-ASCII characters in it. |
| 320 */ | 336 */ |
| 321 TEST_F('NetInternalsTest', 'netInternalsHSTSViewAddError', function() { | 337 TEST_F('NetInternalsTest', 'netInternalsHSTSViewAddError', function() { |
| 322 NetInternalsTest.switchToView('hsts'); | 338 NetInternalsTest.switchToView('hsts'); |
| 323 taskQueue = new NetInternalsTest.TaskQueue(true); | 339 taskQueue = new NetInternalsTest.TaskQueue(true); |
| 324 taskQueue.addTask(new AddTask('\u3024', false, false, '', | 340 var now = new Date().getTime() / 1000.0; |
| 341 taskQueue.addTask(new AddTask('\u3024', false, false, '', now, now, |
| 325 QueryResultType.ERROR)); | 342 QueryResultType.ERROR)); |
| 326 taskQueue.run(); | 343 taskQueue.run(); |
| 327 }); | 344 }); |
| 328 | 345 |
| 329 /** | 346 /** |
| 330 * Adds a domain with an invalid hash. | 347 * Adds a domain with an invalid hash. |
| 331 */ | 348 */ |
| 332 TEST_F('NetInternalsTest', 'netInternalsHSTSViewAddInvalidHash', function() { | 349 TEST_F('NetInternalsTest', 'netInternalsHSTSViewAddInvalidHash', function() { |
| 333 NetInternalsTest.switchToView('hsts'); | 350 NetInternalsTest.switchToView('hsts'); |
| 334 taskQueue = new NetInternalsTest.TaskQueue(true); | 351 taskQueue = new NetInternalsTest.TaskQueue(true); |
| 352 var now = new Date().getTime() / 1000.0; |
| 335 taskQueue.addTask(new AddTask('somewhere.com', true, true, INVALID_HASH, | 353 taskQueue.addTask(new AddTask('somewhere.com', true, true, INVALID_HASH, |
| 336 QueryResultType.SUCCESS)); | 354 now, now, QueryResultType.SUCCESS)); |
| 337 taskQueue.addTask(new DeleteTask('somewhere.com', QueryResultType.NOT_FOUND)); | 355 taskQueue.addTask(new DeleteTask('somewhere.com', QueryResultType.NOT_FOUND)); |
| 338 taskQueue.run(); | 356 taskQueue.run(); |
| 339 }); | 357 }); |
| 340 | 358 |
| 341 /** | 359 /** |
| 342 * Adds the same domain twice in a row, modifying some values the second time. | 360 * Adds the same domain twice in a row, modifying some values the second time. |
| 343 */ | 361 */ |
| 344 TEST_F('NetInternalsTest', 'netInternalsHSTSViewAddOverwrite', function() { | 362 TEST_F('NetInternalsTest', 'netInternalsHSTSViewAddOverwrite', function() { |
| 345 NetInternalsTest.switchToView('hsts'); | 363 NetInternalsTest.switchToView('hsts'); |
| 346 taskQueue = new NetInternalsTest.TaskQueue(true); | 364 taskQueue = new NetInternalsTest.TaskQueue(true); |
| 365 var now = new Date().getTime() / 1000.0; |
| 347 taskQueue.addTask(new AddTask('somewhere.com', true, true, VALID_HASH, | 366 taskQueue.addTask(new AddTask('somewhere.com', true, true, VALID_HASH, |
| 348 QueryResultType.SUCCESS)); | 367 now, now, QueryResultType.SUCCESS)); |
| 349 taskQueue.addTask(new AddTask('somewhere.com', false, false, '', | 368 taskQueue.addTask(new AddTask('somewhere.com', false, false, '', |
| 350 QueryResultType.SUCCESS)); | 369 now, now, QueryResultType.SUCCESS)); |
| 351 taskQueue.addTask(new DeleteTask('somewhere.com', QueryResultType.NOT_FOUND)); | 370 taskQueue.addTask(new DeleteTask('somewhere.com', QueryResultType.NOT_FOUND)); |
| 352 taskQueue.run(); | 371 taskQueue.run(); |
| 353 }); | 372 }); |
| 354 | 373 |
| 355 /** | 374 /** |
| 356 * Adds two different domains and then deletes them. | 375 * Adds two different domains and then deletes them. |
| 357 */ | 376 */ |
| 358 TEST_F('NetInternalsTest', 'netInternalsHSTSViewAddTwice', function() { | 377 TEST_F('NetInternalsTest', 'netInternalsHSTSViewAddTwice', function() { |
| 359 NetInternalsTest.switchToView('hsts'); | 378 NetInternalsTest.switchToView('hsts'); |
| 360 taskQueue = new NetInternalsTest.TaskQueue(true); | 379 taskQueue = new NetInternalsTest.TaskQueue(true); |
| 380 var now = new Date().getTime() / 1000.0; |
| 361 taskQueue.addTask(new AddTask('somewhere.com', false, false, VALID_HASH, | 381 taskQueue.addTask(new AddTask('somewhere.com', false, false, VALID_HASH, |
| 362 QueryResultType.SUCCESS)); | 382 now, now, QueryResultType.SUCCESS)); |
| 363 taskQueue.addTask(new QueryTask('somewhereelse.com', false, false, '', | 383 taskQueue.addTask(new QueryTask('somewhereelse.com', false, false, now, now, |
| 364 QueryResultType.NOT_FOUND)); | 384 '', QueryResultType.NOT_FOUND)); |
| 365 taskQueue.addTask(new AddTask('somewhereelse.com', true, true, '', | 385 taskQueue.addTask(new AddTask('somewhereelse.com', true, true, '', |
| 366 QueryResultType.SUCCESS)); | 386 now, now, QueryResultType.SUCCESS)); |
| 367 taskQueue.addTask(new QueryTask('somewhere.com', false, false, VALID_HASH, | 387 taskQueue.addTask(new QueryTask('somewhere.com', false, false, now, now, |
| 368 QueryResultType.SUCCESS)); | 388 VALID_HASH, QueryResultType.SUCCESS)); |
| 369 taskQueue.addTask(new DeleteTask('somewhere.com', QueryResultType.NOT_FOUND)); | 389 taskQueue.addTask(new DeleteTask('somewhere.com', QueryResultType.NOT_FOUND)); |
| 370 taskQueue.addTask(new QueryTask('somewhereelse.com', true, true, '', | 390 taskQueue.addTask(new QueryTask('somewhereelse.com', true, true, now, now, '', |
| 371 QueryResultType.SUCCESS)); | 391 QueryResultType.SUCCESS)); |
| 372 taskQueue.addTask(new DeleteTask('somewhereelse.com', | 392 taskQueue.addTask(new DeleteTask('somewhereelse.com', |
| 373 QueryResultType.NOT_FOUND)); | 393 QueryResultType.NOT_FOUND)); |
| 374 taskQueue.run(true); | 394 taskQueue.run(true); |
| 375 }); | 395 }); |
| 376 | 396 |
| 377 })(); // Anonymous namespace | 397 })(); // Anonymous namespace |
| OLD | NEW |