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

Side by Side Diff: Source/modules/serviceworkers/CacheTest.cpp

Issue 708703002: Service Worker: Cache.put() consumes request/response bodies (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use Response bodies too, but only Request bodies if non-empty Created 6 years, 1 month 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
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 "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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 WebServiceWorkerCache::BatchOperation putOperation; 391 WebServiceWorkerCache::BatchOperation putOperation;
392 putOperation.operationType = WebServiceWorkerCache::OperationTypePut; 392 putOperation.operationType = WebServiceWorkerCache::OperationTypePut;
393 request->populateWebServiceWorkerRequest(putOperation.request); 393 request->populateWebServiceWorkerRequest(putOperation.request);
394 response->populateWebServiceWorkerResponse(putOperation.response); 394 response->populateWebServiceWorkerResponse(putOperation.response);
395 expectedPutOperations[0] = putOperation; 395 expectedPutOperations[0] = putOperation;
396 } 396 }
397 testCache->setExpectedBatchOperations(&expectedPutOperations); 397 testCache->setExpectedBatchOperations(&expectedPutOperations);
398 398
399 request = newRequestFromUrl(url); 399 request = newRequestFromUrl(url);
400 ASSERT(request); 400 ASSERT(request);
401 ScriptPromise putResult = cache->put(scriptState(), request, response); 401 ScriptPromise putResult = cache->put(scriptState(), request, response->clone (), exceptionState());
402 EXPECT_EQ("dispatchBatch", testCache->getAndClearLastErrorWebCacheMethodCall ed()); 402 EXPECT_EQ("dispatchBatch", testCache->getAndClearLastErrorWebCacheMethodCall ed());
403 EXPECT_EQ(kNotImplementedString, getRejectString(putResult)); 403 EXPECT_EQ(kNotImplementedString, getRejectString(putResult));
404 404
405 ScriptPromise stringPutResult = cache->put(scriptState(), url, response, exc eptionState()); 405 ScriptPromise stringPutResult = cache->put(scriptState(), url, response, exc eptionState());
406 EXPECT_EQ("dispatchBatch", testCache->getAndClearLastErrorWebCacheMethodCall ed()); 406 EXPECT_EQ("dispatchBatch", testCache->getAndClearLastErrorWebCacheMethodCall ed());
407 EXPECT_EQ(kNotImplementedString, getRejectString(stringPutResult)); 407 EXPECT_EQ(kNotImplementedString, getRejectString(stringPutResult));
408 408
409 // FIXME: test add & addAll. 409 // FIXME: test add & addAll.
410 } 410 }
411 411
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 } 539 }
540 540
541 result = cache->deleteFunction(scriptState(), "http://some.url/", options, e xceptionState()); 541 result = cache->deleteFunction(scriptState(), "http://some.url/", options, e xceptionState());
542 scriptValue = getResolveValue(result); 542 scriptValue = getResolveValue(result);
543 EXPECT_TRUE(scriptValue.v8Value()->IsBoolean()); 543 EXPECT_TRUE(scriptValue.v8Value()->IsBoolean());
544 EXPECT_EQ(true, scriptValue.v8Value()->BooleanValue()); 544 EXPECT_EQ(true, scriptValue.v8Value()->BooleanValue());
545 } 545 }
546 546
547 } // namespace 547 } // namespace
548 } // namespace blink 548 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698