OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "config.h" | 5 #include "config.h" |
6 #include "modules/serviceworkers/Cache.h" | 6 #include "modules/serviceworkers/Cache.h" |
7 | 7 |
8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
9 #include "bindings/core/v8/ScriptFunction.h" | 9 #include "bindings/core/v8/ScriptFunction.h" |
10 #include "bindings/core/v8/ScriptPromise.h" | 10 #include "bindings/core/v8/ScriptPromise.h" |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 | 260 |
261 // Lifetime is that of the text fixture. | 261 // Lifetime is that of the text fixture. |
262 OwnPtr<DummyPageHolder> m_page; | 262 OwnPtr<DummyPageHolder> m_page; |
263 | 263 |
264 // Lifetime is per test instance. | 264 // Lifetime is per test instance. |
265 OwnPtr<ScriptState::Scope> m_scriptScope; | 265 OwnPtr<ScriptState::Scope> m_scriptScope; |
266 | 266 |
267 NonThrowableExceptionState m_exceptionState; | 267 NonThrowableExceptionState m_exceptionState; |
268 }; | 268 }; |
269 | 269 |
| 270 RequestInfo stringToRequestInfo(const String& value) |
| 271 { |
| 272 RequestInfo info; |
| 273 info.setUSVString(value); |
| 274 return info; |
| 275 } |
| 276 |
| 277 RequestInfo requestToRequestInfo(Request* value) |
| 278 { |
| 279 RequestInfo info; |
| 280 info.setRequest(value); |
| 281 return info; |
| 282 } |
| 283 |
270 TEST_F(ServiceWorkerCacheTest, Basics) | 284 TEST_F(ServiceWorkerCacheTest, Basics) |
271 { | 285 { |
272 ErrorWebCacheForTests* testCache; | 286 ErrorWebCacheForTests* testCache; |
273 Cache* cache = Cache::create(testCache = new NotImplementedErrorCache()); | 287 Cache* cache = Cache::create(testCache = new NotImplementedErrorCache()); |
274 ASSERT(cache); | 288 ASSERT(cache); |
275 | 289 |
276 const String url = "http://www.cachetest.org/"; | 290 const String url = "http://www.cachetest.org/"; |
277 | 291 |
278 CacheQueryOptions options; | 292 CacheQueryOptions options; |
279 ScriptPromise matchPromise = cache->match(scriptState(), url, options, excep
tionState()); | 293 ScriptPromise matchPromise = cache->match(scriptState(), stringToRequestInfo
(url), options, exceptionState()); |
280 EXPECT_EQ(kNotImplementedString, getRejectString(matchPromise)); | 294 EXPECT_EQ(kNotImplementedString, getRejectString(matchPromise)); |
281 | 295 |
282 cache = Cache::create(testCache = new ErrorWebCacheForTests(WebServiceWorker
CacheErrorNotFound)); | 296 cache = Cache::create(testCache = new ErrorWebCacheForTests(WebServiceWorker
CacheErrorNotFound)); |
283 matchPromise = cache->match(scriptState(), url, options, exceptionState()); | 297 matchPromise = cache->match(scriptState(), stringToRequestInfo(url), options
, exceptionState()); |
284 ScriptValue scriptValue = getResolveValue(matchPromise); | 298 ScriptValue scriptValue = getResolveValue(matchPromise); |
285 EXPECT_TRUE(scriptValue.isUndefined()); | 299 EXPECT_TRUE(scriptValue.isUndefined()); |
286 | 300 |
287 cache = Cache::create(testCache = new ErrorWebCacheForTests(WebServiceWorker
CacheErrorExists)); | 301 cache = Cache::create(testCache = new ErrorWebCacheForTests(WebServiceWorker
CacheErrorExists)); |
288 matchPromise = cache->match(scriptState(), url, options, exceptionState()); | 302 matchPromise = cache->match(scriptState(), stringToRequestInfo(url), options
, exceptionState()); |
289 EXPECT_EQ("InvalidAccessError: Entry already exists.", getRejectString(match
Promise)); | 303 EXPECT_EQ("InvalidAccessError: Entry already exists.", getRejectString(match
Promise)); |
290 } | 304 } |
291 | 305 |
292 // Tests that arguments are faithfully passed on calls to Cache methods, except
for methods which use batch operations, | 306 // Tests that arguments are faithfully passed on calls to Cache methods, except
for methods which use batch operations, |
293 // which are tested later. | 307 // which are tested later. |
294 TEST_F(ServiceWorkerCacheTest, BasicArguments) | 308 TEST_F(ServiceWorkerCacheTest, BasicArguments) |
295 { | 309 { |
296 ErrorWebCacheForTests* testCache; | 310 ErrorWebCacheForTests* testCache; |
297 Cache* cache = Cache::create(testCache = new NotImplementedErrorCache()); | 311 Cache* cache = Cache::create(testCache = new NotImplementedErrorCache()); |
298 ASSERT(cache); | 312 ASSERT(cache); |
299 | 313 |
300 const String url = "http://www.cache.arguments.test/"; | 314 const String url = "http://www.cache.arguments.test/"; |
301 testCache->setExpectedUrl(&url); | 315 testCache->setExpectedUrl(&url); |
302 | 316 |
303 WebServiceWorkerCache::QueryParams expectedQueryParams; | 317 WebServiceWorkerCache::QueryParams expectedQueryParams; |
304 expectedQueryParams.ignoreVary = true; | 318 expectedQueryParams.ignoreVary = true; |
305 expectedQueryParams.cacheName = "this is a cache name"; | 319 expectedQueryParams.cacheName = "this is a cache name"; |
306 testCache->setExpectedQueryParams(&expectedQueryParams); | 320 testCache->setExpectedQueryParams(&expectedQueryParams); |
307 | 321 |
308 CacheQueryOptions options; | 322 CacheQueryOptions options; |
309 options.setIgnoreVary(1); | 323 options.setIgnoreVary(1); |
310 options.setCacheName(expectedQueryParams.cacheName); | 324 options.setCacheName(expectedQueryParams.cacheName); |
311 | 325 |
312 Request* request = newRequestFromUrl(url); | 326 Request* request = newRequestFromUrl(url); |
313 ASSERT(request); | 327 ASSERT(request); |
314 ScriptPromise matchResult = cache->match(scriptState(), request, options); | 328 ScriptPromise matchResult = cache->match(scriptState(), requestToRequestInfo
(request), options, exceptionState()); |
315 EXPECT_EQ("dispatchMatch", testCache->getAndClearLastErrorWebCacheMethodCall
ed()); | 329 EXPECT_EQ("dispatchMatch", testCache->getAndClearLastErrorWebCacheMethodCall
ed()); |
316 EXPECT_EQ(kNotImplementedString, getRejectString(matchResult)); | 330 EXPECT_EQ(kNotImplementedString, getRejectString(matchResult)); |
317 | 331 |
318 ScriptPromise stringMatchResult = cache->match(scriptState(), url, options,
exceptionState()); | 332 ScriptPromise stringMatchResult = cache->match(scriptState(), stringToReques
tInfo(url), options, exceptionState()); |
319 EXPECT_EQ("dispatchMatch", testCache->getAndClearLastErrorWebCacheMethodCall
ed()); | 333 EXPECT_EQ("dispatchMatch", testCache->getAndClearLastErrorWebCacheMethodCall
ed()); |
320 EXPECT_EQ(kNotImplementedString, getRejectString(stringMatchResult)); | 334 EXPECT_EQ(kNotImplementedString, getRejectString(stringMatchResult)); |
321 | 335 |
322 request = newRequestFromUrl(url); | 336 request = newRequestFromUrl(url); |
323 ASSERT(request); | 337 ASSERT(request); |
324 ScriptPromise matchAllResult = cache->matchAll(scriptState(), request, optio
ns); | 338 ScriptPromise matchAllResult = cache->matchAll(scriptState(), requestToReque
stInfo(request), options, exceptionState()); |
325 EXPECT_EQ("dispatchMatchAll", testCache->getAndClearLastErrorWebCacheMethodC
alled()); | 339 EXPECT_EQ("dispatchMatchAll", testCache->getAndClearLastErrorWebCacheMethodC
alled()); |
326 EXPECT_EQ(kNotImplementedString, getRejectString(matchAllResult)); | 340 EXPECT_EQ(kNotImplementedString, getRejectString(matchAllResult)); |
327 | 341 |
328 ScriptPromise stringMatchAllResult = cache->matchAll(scriptState(), url, opt
ions, exceptionState()); | 342 ScriptPromise stringMatchAllResult = cache->matchAll(scriptState(), stringTo
RequestInfo(url), options, exceptionState()); |
329 EXPECT_EQ("dispatchMatchAll", testCache->getAndClearLastErrorWebCacheMethodC
alled()); | 343 EXPECT_EQ("dispatchMatchAll", testCache->getAndClearLastErrorWebCacheMethodC
alled()); |
330 EXPECT_EQ(kNotImplementedString, getRejectString(stringMatchAllResult)); | 344 EXPECT_EQ(kNotImplementedString, getRejectString(stringMatchAllResult)); |
331 | 345 |
332 ScriptPromise keysResult1 = cache->keys(scriptState()); | 346 ScriptPromise keysResult1 = cache->keys(scriptState(), exceptionState()); |
333 EXPECT_EQ("dispatchKeys", testCache->getAndClearLastErrorWebCacheMethodCalle
d()); | 347 EXPECT_EQ("dispatchKeys", testCache->getAndClearLastErrorWebCacheMethodCalle
d()); |
334 EXPECT_EQ(kNotImplementedString, getRejectString(keysResult1)); | 348 EXPECT_EQ(kNotImplementedString, getRejectString(keysResult1)); |
335 | 349 |
336 request = newRequestFromUrl(url); | 350 request = newRequestFromUrl(url); |
337 ASSERT(request); | 351 ASSERT(request); |
338 ScriptPromise keysResult2 = cache->keys(scriptState(), request, options); | 352 ScriptPromise keysResult2 = cache->keys(scriptState(), requestToRequestInfo(
request), options, exceptionState()); |
339 EXPECT_EQ("dispatchKeys", testCache->getAndClearLastErrorWebCacheMethodCalle
d()); | 353 EXPECT_EQ("dispatchKeys", testCache->getAndClearLastErrorWebCacheMethodCalle
d()); |
340 EXPECT_EQ(kNotImplementedString, getRejectString(keysResult2)); | 354 EXPECT_EQ(kNotImplementedString, getRejectString(keysResult2)); |
341 | 355 |
342 ScriptPromise stringKeysResult2 = cache->keys(scriptState(), url, options, e
xceptionState()); | 356 ScriptPromise stringKeysResult2 = cache->keys(scriptState(), stringToRequest
Info(url), options, exceptionState()); |
343 EXPECT_EQ("dispatchKeys", testCache->getAndClearLastErrorWebCacheMethodCalle
d()); | 357 EXPECT_EQ("dispatchKeys", testCache->getAndClearLastErrorWebCacheMethodCalle
d()); |
344 EXPECT_EQ(kNotImplementedString, getRejectString(stringKeysResult2)); | 358 EXPECT_EQ(kNotImplementedString, getRejectString(stringKeysResult2)); |
345 } | 359 } |
346 | 360 |
347 // Tests that arguments are faithfully passed to API calls that degrade to batch
operations. | 361 // Tests that arguments are faithfully passed to API calls that degrade to batch
operations. |
348 TEST_F(ServiceWorkerCacheTest, BatchOperationArguments) | 362 TEST_F(ServiceWorkerCacheTest, BatchOperationArguments) |
349 { | 363 { |
350 ErrorWebCacheForTests* testCache; | 364 ErrorWebCacheForTests* testCache; |
351 Cache* cache = Cache::create(testCache = new NotImplementedErrorCache()); | 365 Cache* cache = Cache::create(testCache = new NotImplementedErrorCache()); |
352 ASSERT(cache); | 366 ASSERT(cache); |
(...skipping 18 matching lines...) Expand all Loading... |
371 WebVector<WebServiceWorkerCache::BatchOperation> expectedDeleteOperations(si
ze_t(1)); | 385 WebVector<WebServiceWorkerCache::BatchOperation> expectedDeleteOperations(si
ze_t(1)); |
372 { | 386 { |
373 WebServiceWorkerCache::BatchOperation deleteOperation; | 387 WebServiceWorkerCache::BatchOperation deleteOperation; |
374 deleteOperation.operationType = WebServiceWorkerCache::OperationTypeDele
te; | 388 deleteOperation.operationType = WebServiceWorkerCache::OperationTypeDele
te; |
375 request->populateWebServiceWorkerRequest(deleteOperation.request); | 389 request->populateWebServiceWorkerRequest(deleteOperation.request); |
376 deleteOperation.matchParams = expectedQueryParams; | 390 deleteOperation.matchParams = expectedQueryParams; |
377 expectedDeleteOperations[0] = deleteOperation; | 391 expectedDeleteOperations[0] = deleteOperation; |
378 } | 392 } |
379 testCache->setExpectedBatchOperations(&expectedDeleteOperations); | 393 testCache->setExpectedBatchOperations(&expectedDeleteOperations); |
380 | 394 |
381 ScriptPromise deleteResult = cache->deleteFunction(scriptState(), request, o
ptions); | 395 ScriptPromise deleteResult = cache->deleteFunction(scriptState(), requestToR
equestInfo(request), options, exceptionState()); |
382 EXPECT_EQ("dispatchBatch", testCache->getAndClearLastErrorWebCacheMethodCall
ed()); | 396 EXPECT_EQ("dispatchBatch", testCache->getAndClearLastErrorWebCacheMethodCall
ed()); |
383 EXPECT_EQ(kNotImplementedString, getRejectString(deleteResult)); | 397 EXPECT_EQ(kNotImplementedString, getRejectString(deleteResult)); |
384 | 398 |
385 ScriptPromise stringDeleteResult = cache->deleteFunction(scriptState(), url,
options, exceptionState()); | 399 ScriptPromise stringDeleteResult = cache->deleteFunction(scriptState(), stri
ngToRequestInfo(url), options, exceptionState()); |
386 EXPECT_EQ("dispatchBatch", testCache->getAndClearLastErrorWebCacheMethodCall
ed()); | 400 EXPECT_EQ("dispatchBatch", testCache->getAndClearLastErrorWebCacheMethodCall
ed()); |
387 EXPECT_EQ(kNotImplementedString, getRejectString(stringDeleteResult)); | 401 EXPECT_EQ(kNotImplementedString, getRejectString(stringDeleteResult)); |
388 | 402 |
389 WebVector<WebServiceWorkerCache::BatchOperation> expectedPutOperations(size_
t(1)); | 403 WebVector<WebServiceWorkerCache::BatchOperation> expectedPutOperations(size_
t(1)); |
390 { | 404 { |
391 WebServiceWorkerCache::BatchOperation putOperation; | 405 WebServiceWorkerCache::BatchOperation putOperation; |
392 putOperation.operationType = WebServiceWorkerCache::OperationTypePut; | 406 putOperation.operationType = WebServiceWorkerCache::OperationTypePut; |
393 request->populateWebServiceWorkerRequest(putOperation.request); | 407 request->populateWebServiceWorkerRequest(putOperation.request); |
394 response->populateWebServiceWorkerResponse(putOperation.response); | 408 response->populateWebServiceWorkerResponse(putOperation.response); |
395 expectedPutOperations[0] = putOperation; | 409 expectedPutOperations[0] = putOperation; |
396 } | 410 } |
397 testCache->setExpectedBatchOperations(&expectedPutOperations); | 411 testCache->setExpectedBatchOperations(&expectedPutOperations); |
398 | 412 |
399 request = newRequestFromUrl(url); | 413 request = newRequestFromUrl(url); |
400 ASSERT(request); | 414 ASSERT(request); |
401 ScriptPromise putResult = cache->put(scriptState(), request, response); | 415 ScriptPromise putResult = cache->put(scriptState(), requestToRequestInfo(req
uest), response, exceptionState()); |
402 EXPECT_EQ("dispatchBatch", testCache->getAndClearLastErrorWebCacheMethodCall
ed()); | 416 EXPECT_EQ("dispatchBatch", testCache->getAndClearLastErrorWebCacheMethodCall
ed()); |
403 EXPECT_EQ(kNotImplementedString, getRejectString(putResult)); | 417 EXPECT_EQ(kNotImplementedString, getRejectString(putResult)); |
404 | 418 |
405 ScriptPromise stringPutResult = cache->put(scriptState(), url, response, exc
eptionState()); | 419 ScriptPromise stringPutResult = cache->put(scriptState(), stringToRequestInf
o(url), response, exceptionState()); |
406 EXPECT_EQ("dispatchBatch", testCache->getAndClearLastErrorWebCacheMethodCall
ed()); | 420 EXPECT_EQ("dispatchBatch", testCache->getAndClearLastErrorWebCacheMethodCall
ed()); |
407 EXPECT_EQ(kNotImplementedString, getRejectString(stringPutResult)); | 421 EXPECT_EQ(kNotImplementedString, getRejectString(stringPutResult)); |
408 | 422 |
409 // FIXME: test add & addAll. | 423 // FIXME: test add & addAll. |
410 } | 424 } |
411 | 425 |
412 class MatchTestCache : public NotImplementedErrorCache { | 426 class MatchTestCache : public NotImplementedErrorCache { |
413 public: | 427 public: |
414 MatchTestCache(WebServiceWorkerResponse& response) | 428 MatchTestCache(WebServiceWorkerResponse& response) |
415 : m_response(response) { } | 429 : m_response(response) { } |
(...skipping 14 matching lines...) Expand all Loading... |
430 const String requestUrl = "http://request.url/"; | 444 const String requestUrl = "http://request.url/"; |
431 const String responseUrl = "http://match.response.test/"; | 445 const String responseUrl = "http://match.response.test/"; |
432 | 446 |
433 WebServiceWorkerResponse webResponse; | 447 WebServiceWorkerResponse webResponse; |
434 webResponse.setURL(KURL(ParsedURLString, responseUrl)); | 448 webResponse.setURL(KURL(ParsedURLString, responseUrl)); |
435 webResponse.setResponseType(WebServiceWorkerResponseTypeDefault); | 449 webResponse.setResponseType(WebServiceWorkerResponseTypeDefault); |
436 | 450 |
437 Cache* cache = Cache::create(new MatchTestCache(webResponse)); | 451 Cache* cache = Cache::create(new MatchTestCache(webResponse)); |
438 CacheQueryOptions options; | 452 CacheQueryOptions options; |
439 | 453 |
440 ScriptPromise result = cache->match(scriptState(), requestUrl, options, exce
ptionState()); | 454 ScriptPromise result = cache->match(scriptState(), stringToRequestInfo(reque
stUrl), options, exceptionState()); |
441 ScriptValue scriptValue = getResolveValue(result); | 455 ScriptValue scriptValue = getResolveValue(result); |
442 Response* response = V8Response::toImplWithTypeCheck(isolate(), scriptValue.
v8Value()); | 456 Response* response = V8Response::toImplWithTypeCheck(isolate(), scriptValue.
v8Value()); |
443 ASSERT_TRUE(response); | 457 ASSERT_TRUE(response); |
444 EXPECT_EQ(responseUrl, response->url()); | 458 EXPECT_EQ(responseUrl, response->url()); |
445 } | 459 } |
446 | 460 |
447 class KeysTestCache : public NotImplementedErrorCache { | 461 class KeysTestCache : public NotImplementedErrorCache { |
448 public: | 462 public: |
449 KeysTestCache(WebVector<WebServiceWorkerRequest>& requests) | 463 KeysTestCache(WebVector<WebServiceWorkerRequest>& requests) |
450 : m_requests(requests) { } | 464 : m_requests(requests) { } |
(...skipping 16 matching lines...) Expand all Loading... |
467 Vector<String> expectedUrls(size_t(2)); | 481 Vector<String> expectedUrls(size_t(2)); |
468 expectedUrls[0] = url1; | 482 expectedUrls[0] = url1; |
469 expectedUrls[1] = url2; | 483 expectedUrls[1] = url2; |
470 | 484 |
471 WebVector<WebServiceWorkerRequest> webRequests(size_t(2)); | 485 WebVector<WebServiceWorkerRequest> webRequests(size_t(2)); |
472 webRequests[0].setURL(KURL(ParsedURLString, url1)); | 486 webRequests[0].setURL(KURL(ParsedURLString, url1)); |
473 webRequests[1].setURL(KURL(ParsedURLString, url2)); | 487 webRequests[1].setURL(KURL(ParsedURLString, url2)); |
474 | 488 |
475 Cache* cache = Cache::create(new KeysTestCache(webRequests)); | 489 Cache* cache = Cache::create(new KeysTestCache(webRequests)); |
476 | 490 |
477 ScriptPromise result = cache->keys(scriptState()); | 491 ScriptPromise result = cache->keys(scriptState(), exceptionState()); |
478 ScriptValue scriptValue = getResolveValue(result); | 492 ScriptValue scriptValue = getResolveValue(result); |
479 | 493 |
480 Vector<v8::Handle<v8::Value> > requests = toImplArray<v8::Handle<v8::Value>
>(scriptValue.v8Value(), 0, isolate(), exceptionState()); | 494 Vector<v8::Handle<v8::Value> > requests = toImplArray<v8::Handle<v8::Value>
>(scriptValue.v8Value(), 0, isolate(), exceptionState()); |
481 EXPECT_EQ(expectedUrls.size(), requests.size()); | 495 EXPECT_EQ(expectedUrls.size(), requests.size()); |
482 for (int i = 0, minsize = std::min(expectedUrls.size(), requests.size()); i
< minsize; ++i) { | 496 for (int i = 0, minsize = std::min(expectedUrls.size(), requests.size()); i
< minsize; ++i) { |
483 Request* request = V8Request::toImplWithTypeCheck(isolate(), requests[i]
); | 497 Request* request = V8Request::toImplWithTypeCheck(isolate(), requests[i]
); |
484 EXPECT_TRUE(request); | 498 EXPECT_TRUE(request); |
485 if (request) | 499 if (request) |
486 EXPECT_EQ(expectedUrls[i], request->url()); | 500 EXPECT_EQ(expectedUrls[i], request->url()); |
487 } | 501 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 | 533 |
520 WebVector<WebServiceWorkerResponse> webResponses(size_t(2)); | 534 WebVector<WebServiceWorkerResponse> webResponses(size_t(2)); |
521 webResponses[0].setURL(KURL(ParsedURLString, url1)); | 535 webResponses[0].setURL(KURL(ParsedURLString, url1)); |
522 webResponses[0].setResponseType(WebServiceWorkerResponseTypeDefault); | 536 webResponses[0].setResponseType(WebServiceWorkerResponseTypeDefault); |
523 webResponses[1].setURL(KURL(ParsedURLString, url2)); | 537 webResponses[1].setURL(KURL(ParsedURLString, url2)); |
524 webResponses[1].setResponseType(WebServiceWorkerResponseTypeDefault); | 538 webResponses[1].setResponseType(WebServiceWorkerResponseTypeDefault); |
525 | 539 |
526 Cache* cache = Cache::create(new MatchAllAndBatchTestCache(webResponses)); | 540 Cache* cache = Cache::create(new MatchAllAndBatchTestCache(webResponses)); |
527 | 541 |
528 CacheQueryOptions options; | 542 CacheQueryOptions options; |
529 ScriptPromise result = cache->matchAll(scriptState(), "http://some.url/", op
tions, exceptionState()); | 543 ScriptPromise result = cache->matchAll(scriptState(), stringToRequestInfo("h
ttp://some.url/"), options, exceptionState()); |
530 ScriptValue scriptValue = getResolveValue(result); | 544 ScriptValue scriptValue = getResolveValue(result); |
531 | 545 |
532 Vector<v8::Handle<v8::Value> > responses = toImplArray<v8::Handle<v8::Value>
>(scriptValue.v8Value(), 0, isolate(), exceptionState()); | 546 Vector<v8::Handle<v8::Value> > responses = toImplArray<v8::Handle<v8::Value>
>(scriptValue.v8Value(), 0, isolate(), exceptionState()); |
533 EXPECT_EQ(expectedUrls.size(), responses.size()); | 547 EXPECT_EQ(expectedUrls.size(), responses.size()); |
534 for (int i = 0, minsize = std::min(expectedUrls.size(), responses.size()); i
< minsize; ++i) { | 548 for (int i = 0, minsize = std::min(expectedUrls.size(), responses.size()); i
< minsize; ++i) { |
535 Response* response = V8Response::toImplWithTypeCheck(isolate(), response
s[i]); | 549 Response* response = V8Response::toImplWithTypeCheck(isolate(), response
s[i]); |
536 EXPECT_TRUE(response); | 550 EXPECT_TRUE(response); |
537 if (response) | 551 if (response) |
538 EXPECT_EQ(expectedUrls[i], response->url()); | 552 EXPECT_EQ(expectedUrls[i], response->url()); |
539 } | 553 } |
540 | 554 |
541 result = cache->deleteFunction(scriptState(), "http://some.url/", options, e
xceptionState()); | 555 result = cache->deleteFunction(scriptState(), stringToRequestInfo("http://so
me.url/"), options, exceptionState()); |
542 scriptValue = getResolveValue(result); | 556 scriptValue = getResolveValue(result); |
543 EXPECT_TRUE(scriptValue.v8Value()->IsBoolean()); | 557 EXPECT_TRUE(scriptValue.v8Value()->IsBoolean()); |
544 EXPECT_EQ(true, scriptValue.v8Value()->BooleanValue()); | 558 EXPECT_EQ(true, scriptValue.v8Value()->BooleanValue()); |
545 } | 559 } |
546 | 560 |
547 } // namespace | 561 } // namespace |
548 } // namespace blink | 562 } // namespace blink |
OLD | NEW |