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

Side by Side Diff: third_party/WebKit/Source/modules/cachestorage/CacheTest.cpp

Issue 1899873006: Make Response::body return v8-extra based stream behind flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@notify-locked-released
Patch Set: Created 4 years, 8 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 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 "modules/cachestorage/Cache.h" 5 #include "modules/cachestorage/Cache.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "bindings/core/v8/ScriptFunction.h" 8 #include "bindings/core/v8/ScriptFunction.h"
9 #include "bindings/core/v8/ScriptPromise.h" 9 #include "bindings/core/v8/ScriptPromise.h"
10 #include "bindings/core/v8/ScriptPromiseResolver.h" 10 #include "bindings/core/v8/ScriptPromiseResolver.h"
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 420
421 CacheQueryOptions options; 421 CacheQueryOptions options;
422 options.setCacheName(expectedQueryParams.cacheName); 422 options.setCacheName(expectedQueryParams.cacheName);
423 423
424 const String url = "http://batch.operations.test/"; 424 const String url = "http://batch.operations.test/";
425 Request* request = newRequestFromUrl(url); 425 Request* request = newRequestFromUrl(url);
426 ASSERT(request); 426 ASSERT(request);
427 427
428 WebServiceWorkerResponse webResponse; 428 WebServiceWorkerResponse webResponse;
429 webResponse.setURL(KURL(ParsedURLString, url)); 429 webResponse.setURL(KURL(ParsedURLString, url));
430 Response* response = Response::create(getExecutionContext(), webResponse); 430 Response* response = Response::create(getScriptState(), webResponse);
431 431
432 WebVector<WebServiceWorkerCache::BatchOperation> expectedDeleteOperations(si ze_t(1)); 432 WebVector<WebServiceWorkerCache::BatchOperation> expectedDeleteOperations(si ze_t(1));
433 { 433 {
434 WebServiceWorkerCache::BatchOperation deleteOperation; 434 WebServiceWorkerCache::BatchOperation deleteOperation;
435 deleteOperation.operationType = WebServiceWorkerCache::OperationTypeDele te; 435 deleteOperation.operationType = WebServiceWorkerCache::OperationTypeDele te;
436 request->populateWebServiceWorkerRequest(deleteOperation.request); 436 request->populateWebServiceWorkerRequest(deleteOperation.request);
437 deleteOperation.matchParams = expectedQueryParams; 437 deleteOperation.matchParams = expectedQueryParams;
438 expectedDeleteOperations[0] = deleteOperation; 438 expectedDeleteOperations[0] = deleteOperation;
439 } 439 }
440 testCache->setExpectedBatchOperations(&expectedDeleteOperations); 440 testCache->setExpectedBatchOperations(&expectedDeleteOperations);
(...skipping 11 matching lines...) Expand all
452 WebServiceWorkerCache::BatchOperation putOperation; 452 WebServiceWorkerCache::BatchOperation putOperation;
453 putOperation.operationType = WebServiceWorkerCache::OperationTypePut; 453 putOperation.operationType = WebServiceWorkerCache::OperationTypePut;
454 request->populateWebServiceWorkerRequest(putOperation.request); 454 request->populateWebServiceWorkerRequest(putOperation.request);
455 response->populateWebServiceWorkerResponse(putOperation.response); 455 response->populateWebServiceWorkerResponse(putOperation.response);
456 expectedPutOperations[0] = putOperation; 456 expectedPutOperations[0] = putOperation;
457 } 457 }
458 testCache->setExpectedBatchOperations(&expectedPutOperations); 458 testCache->setExpectedBatchOperations(&expectedPutOperations);
459 459
460 request = newRequestFromUrl(url); 460 request = newRequestFromUrl(url);
461 ASSERT(request); 461 ASSERT(request);
462 ScriptPromise putResult = cache->put(getScriptState(), requestToRequestInfo( request), response->clone(exceptionState()), exceptionState()); 462 ScriptPromise putResult = cache->put(getScriptState(), requestToRequestInfo( request), response->clone(getScriptState(), exceptionState()), exceptionState()) ;
463 EXPECT_EQ("dispatchBatch", testCache->getAndClearLastErrorWebCacheMethodCall ed()); 463 EXPECT_EQ("dispatchBatch", testCache->getAndClearLastErrorWebCacheMethodCall ed());
464 EXPECT_EQ(kNotImplementedString, getRejectString(putResult)); 464 EXPECT_EQ(kNotImplementedString, getRejectString(putResult));
465 465
466 ScriptPromise stringPutResult = cache->put(getScriptState(), stringToRequest Info(url), response, exceptionState()); 466 ScriptPromise stringPutResult = cache->put(getScriptState(), stringToRequest Info(url), response, exceptionState());
467 EXPECT_EQ("dispatchBatch", testCache->getAndClearLastErrorWebCacheMethodCall ed()); 467 EXPECT_EQ("dispatchBatch", testCache->getAndClearLastErrorWebCacheMethodCall ed());
468 EXPECT_EQ(kNotImplementedString, getRejectString(stringPutResult)); 468 EXPECT_EQ(kNotImplementedString, getRejectString(stringPutResult));
469 469
470 // FIXME: test add & addAll. 470 // FIXME: test add & addAll.
471 } 471 }
472 472
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 const String url = "http://www.cacheadd.test/"; 618 const String url = "http://www.cacheadd.test/";
619 const String contentType = "text/plain"; 619 const String contentType = "text/plain";
620 const String content = "hello cache"; 620 const String content = "hello cache";
621 621
622 ErrorWebCacheForTests* testCache; 622 ErrorWebCacheForTests* testCache;
623 Cache* cache = createCache(fetcher, testCache = new NotImplementedErrorCache ()); 623 Cache* cache = createCache(fetcher, testCache = new NotImplementedErrorCache ());
624 624
625 fetcher->setExpectedFetchUrl(&url); 625 fetcher->setExpectedFetchUrl(&url);
626 626
627 Request* request = newRequestFromUrl(url); 627 Request* request = newRequestFromUrl(url);
628 Response* response = Response::create(getExecutionContext(), FetchFormDataCo nsumerHandle::create(content), contentType, ResponseInit(), exceptionState()); 628 Response* response = Response::create(getScriptState(), FetchFormDataConsume rHandle::create(content), contentType, ResponseInit(), exceptionState());
629 fetcher->setResponse(response); 629 fetcher->setResponse(response);
630 630
631 WebVector<WebServiceWorkerCache::BatchOperation> expectedPutOperations(size_ t(1)); 631 WebVector<WebServiceWorkerCache::BatchOperation> expectedPutOperations(size_ t(1));
632 { 632 {
633 WebServiceWorkerCache::BatchOperation putOperation; 633 WebServiceWorkerCache::BatchOperation putOperation;
634 putOperation.operationType = WebServiceWorkerCache::OperationTypePut; 634 putOperation.operationType = WebServiceWorkerCache::OperationTypePut;
635 request->populateWebServiceWorkerRequest(putOperation.request); 635 request->populateWebServiceWorkerRequest(putOperation.request);
636 response->populateWebServiceWorkerResponse(putOperation.response); 636 response->populateWebServiceWorkerResponse(putOperation.response);
637 expectedPutOperations[0] = putOperation; 637 expectedPutOperations[0] = putOperation;
638 } 638 }
639 testCache->setExpectedBatchOperations(&expectedPutOperations); 639 testCache->setExpectedBatchOperations(&expectedPutOperations);
640 640
641 ScriptPromise addResult = cache->add(getScriptState(), requestToRequestInfo( request), exceptionState()); 641 ScriptPromise addResult = cache->add(getScriptState(), requestToRequestInfo( request), exceptionState());
642 642
643 EXPECT_EQ(kNotImplementedString, getRejectString(addResult)); 643 EXPECT_EQ(kNotImplementedString, getRejectString(addResult));
644 EXPECT_EQ(1, fetcher->fetchCount()); 644 EXPECT_EQ(1, fetcher->fetchCount());
645 EXPECT_EQ("dispatchBatch", testCache->getAndClearLastErrorWebCacheMethodCall ed()); 645 EXPECT_EQ("dispatchBatch", testCache->getAndClearLastErrorWebCacheMethodCall ed());
646 } 646 }
647 647
648 } // namespace 648 } // namespace
649 } // namespace blink 649 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698