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

Unified Diff: Source/modules/serviceworkers/CacheTest.cpp

Issue 546153002: Patch on top of https://codereview.chromium.org/433793002/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/serviceworkers/Cache.cpp ('k') | Source/modules/serviceworkers/Request.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/serviceworkers/CacheTest.cpp
diff --git a/Source/modules/serviceworkers/CacheTest.cpp b/Source/modules/serviceworkers/CacheTest.cpp
index 397c0c9878c3802db2cd870873dee9ded0a48192..9a6b7bba7f5861f2afb91d8b279fac27f100bb7e 100644
--- a/Source/modules/serviceworkers/CacheTest.cpp
+++ b/Source/modules/serviceworkers/CacheTest.cpp
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "config.h"
+#include "modules/serviceworkers/Cache.h"
#include "bindings/core/v8/ExceptionState.h"
#include "bindings/core/v8/ScriptFunction.h"
@@ -14,7 +15,6 @@
#include "core/dom/Document.h"
#include "core/frame/Frame.h"
#include "core/testing/DummyPageHolder.h"
-#include "modules/serviceworkers/Cache.h"
#include "modules/serviceworkers/Request.h"
#include "modules/serviceworkers/Response.h"
#include "public/platform/WebServiceWorkerCache.h"
@@ -257,7 +257,7 @@ private:
TEST_F(ServiceWorkerCacheTest, Basics)
{
ErrorWebCacheForTests* testCache;
- RefPtrWillBeRawPtr<Cache> cache = Cache::fromWebServiceWorkerCache(testCache = new NotImplementedErrorCache());
+ Cache* cache = Cache::fromWebServiceWorkerCache(testCache = new NotImplementedErrorCache());
ASSERT(cache);
const String url = "http://www.cachetest.org/";
@@ -279,7 +279,7 @@ TEST_F(ServiceWorkerCacheTest, Basics)
TEST_F(ServiceWorkerCacheTest, BasicArguments)
{
ErrorWebCacheForTests* testCache;
- RefPtrWillBeRawPtr<Cache> cache = Cache::fromWebServiceWorkerCache(testCache = new NotImplementedErrorCache());
+ Cache* cache = Cache::fromWebServiceWorkerCache(testCache = new NotImplementedErrorCache());
ASSERT(cache);
const String url = "http://www.cache.arguments.test/";
@@ -295,11 +295,11 @@ TEST_F(ServiceWorkerCacheTest, BasicArguments)
queryParamsDict.set("cacheName", expectedQueryParams.cacheName);
TrackExceptionState exceptionState;
- const RefPtrWillBeRawPtr<Request> request = Request::create(executionContext(), url, exceptionState);
+ const Request* request = Request::create(executionContext(), url, exceptionState);
ASSERT(request);
ASSERT_FALSE(exceptionState.hadException());
- ScriptPromise matchResult = cache->match(scriptState(), request.get(), queryParamsDict);
+ ScriptPromise matchResult = cache->match(scriptState(), request, queryParamsDict);
EXPECT_EQ("dispatchMatch", testCache->getAndClearLastErrorWebCacheMethodCalled());
expectNotImplemented(matchResult);
@@ -307,7 +307,7 @@ TEST_F(ServiceWorkerCacheTest, BasicArguments)
EXPECT_EQ("dispatchMatch", testCache->getAndClearLastErrorWebCacheMethodCalled());
expectNotImplemented(stringMatchResult);
- ScriptPromise matchAllResult = cache->matchAll(scriptState(), request.get(), queryParamsDict);
+ ScriptPromise matchAllResult = cache->matchAll(scriptState(), request, queryParamsDict);
EXPECT_EQ("dispatchMatchAll", testCache->getAndClearLastErrorWebCacheMethodCalled());
expectNotImplemented(matchAllResult);
@@ -319,7 +319,7 @@ TEST_F(ServiceWorkerCacheTest, BasicArguments)
EXPECT_EQ("dispatchKeys", testCache->getAndClearLastErrorWebCacheMethodCalled());
expectNotImplemented(keysResult1);
- ScriptPromise keysResult2 = cache->keys(scriptState(), request.get(), queryParamsDict);
+ ScriptPromise keysResult2 = cache->keys(scriptState(), request, queryParamsDict);
EXPECT_EQ("dispatchKeys", testCache->getAndClearLastErrorWebCacheMethodCalled());
expectNotImplemented(keysResult2);
@@ -332,7 +332,7 @@ TEST_F(ServiceWorkerCacheTest, BasicArguments)
TEST_F(ServiceWorkerCacheTest, BatchOperationArguments)
{
ErrorWebCacheForTests* testCache;
- RefPtrWillBeRawPtr<Cache> cache = Cache::fromWebServiceWorkerCache(testCache = new NotImplementedErrorCache());
+ Cache* cache = Cache::fromWebServiceWorkerCache(testCache = new NotImplementedErrorCache());
ASSERT(cache);
WebServiceWorkerCache::QueryParams expectedQueryParams;
@@ -346,13 +346,13 @@ TEST_F(ServiceWorkerCacheTest, BatchOperationArguments)
const String url = "http://batch.operations.test/";
TrackExceptionState exceptionState;
- const RefPtrWillBeRawPtr<Request> request = Request::create(executionContext(), url, exceptionState);
+ const Request* request = Request::create(executionContext(), url, exceptionState);
ASSERT(request);
ASSERT_FALSE(exceptionState.hadException());
WebServiceWorkerResponse webResponse;
webResponse.setURL(KURL(ParsedURLString, url));
- const RefPtrWillBeRawPtr<Response> response = Response::create(webResponse);
+ const Response* response = Response::create(webResponse);
WebVector<WebServiceWorkerCache::BatchOperation> expectedDeleteOperations(size_t(1));
{
@@ -364,7 +364,7 @@ TEST_F(ServiceWorkerCacheTest, BatchOperationArguments)
}
testCache->setExpectedBatchOperations(&expectedDeleteOperations);
- ScriptPromise deleteResult = cache->deleteFunction(scriptState(), request.get(), queryParamsDict);
+ ScriptPromise deleteResult = cache->deleteFunction(scriptState(), request, queryParamsDict);
EXPECT_EQ("dispatchBatch", testCache->getAndClearLastErrorWebCacheMethodCalled());
expectNotImplemented(deleteResult);
@@ -382,11 +382,11 @@ TEST_F(ServiceWorkerCacheTest, BatchOperationArguments)
}
testCache->setExpectedBatchOperations(&expectedPutOperations);
- ScriptPromise putResult = cache->put(scriptState(), request.get(), response.get());
+ ScriptPromise putResult = cache->put(scriptState(), request, response);
EXPECT_EQ("dispatchBatch", testCache->getAndClearLastErrorWebCacheMethodCalled());
expectNotImplemented(putResult);
- ScriptPromise stringPutResult = cache->put(scriptState(), url, response.get());
+ ScriptPromise stringPutResult = cache->put(scriptState(), url, response);
EXPECT_EQ("dispatchBatch", testCache->getAndClearLastErrorWebCacheMethodCalled());
expectNotImplemented(stringPutResult);
@@ -417,11 +417,11 @@ TEST_F(ServiceWorkerCacheTest, MatchResponseTest)
WebServiceWorkerResponse webResponse;
webResponse.setURL(KURL(ParsedURLString, responseUrl));
- RefPtrWillBeRawPtr<Cache> cache = Cache::fromWebServiceWorkerCache(new MatchTestCache(webResponse));
+ Cache* cache = Cache::fromWebServiceWorkerCache(new MatchTestCache(webResponse));
ScriptPromise result = cache->match(scriptState(), requestUrl, Dictionary());
ScriptValue scriptValue = getResolveValue(result);
- Response* response = V8Response::toNativeWithTypeCheck(isolate(), scriptValue.v8Value());
+ Response* response = V8Response::toImplWithTypeCheck(isolate(), scriptValue.v8Value());
ASSERT_TRUE(response);
EXPECT_EQ(responseUrl, response->url());
}
@@ -454,15 +454,15 @@ TEST_F(ServiceWorkerCacheTest, KeysResponseTest)
webRequests[0].setURL(KURL(ParsedURLString, url1));
webRequests[1].setURL(KURL(ParsedURLString, url2));
- RefPtrWillBeRawPtr<Cache> cache = Cache::fromWebServiceWorkerCache(new KeysTestCache(webRequests));
+ Cache* cache = Cache::fromWebServiceWorkerCache(new KeysTestCache(webRequests));
ScriptPromise result = cache->keys(scriptState());
ScriptValue scriptValue = getResolveValue(result);
- Vector<v8::Handle<v8::Value> > requests = toNativeArray<v8::Handle<v8::Value> >(scriptValue.v8Value(), 0, isolate());
+ Vector<v8::Handle<v8::Value> > requests = toImplArray<v8::Handle<v8::Value> >(scriptValue.v8Value(), 0, isolate());
EXPECT_EQ(expectedUrls.size(), requests.size());
for (int i = 0, minsize = std::min(expectedUrls.size(), requests.size()); i < minsize; ++i) {
- Request* request = V8Request::toNativeWithTypeCheck(isolate(), requests[i]);
+ Request* request = V8Request::toImplWithTypeCheck(isolate(), requests[i]);
EXPECT_TRUE(request);
if (request)
EXPECT_EQ(expectedUrls[i], request->url());
@@ -503,15 +503,15 @@ TEST_F(ServiceWorkerCacheTest, MatchAllAndBatchResponseTest)
webResponses[0].setURL(KURL(ParsedURLString, url1));
webResponses[1].setURL(KURL(ParsedURLString, url2));
- RefPtrWillBeRawPtr<Cache> cache = Cache::fromWebServiceWorkerCache(new MatchAllAndBatchTestCache(webResponses));
+ Cache* cache = Cache::fromWebServiceWorkerCache(new MatchAllAndBatchTestCache(webResponses));
ScriptPromise result = cache->matchAll(scriptState(), "http://some.url/", Dictionary());
ScriptValue scriptValue = getResolveValue(result);
- Vector<v8::Handle<v8::Value> > responses = toNativeArray<v8::Handle<v8::Value> >(scriptValue.v8Value(), 0, isolate());
+ Vector<v8::Handle<v8::Value> > responses = toImplArray<v8::Handle<v8::Value> >(scriptValue.v8Value(), 0, isolate());
EXPECT_EQ(expectedUrls.size(), responses.size());
for (int i = 0, minsize = std::min(expectedUrls.size(), responses.size()); i < minsize; ++i) {
- Response* response = V8Response::toNativeWithTypeCheck(isolate(), responses[i]);
+ Response* response = V8Response::toImplWithTypeCheck(isolate(), responses[i]);
EXPECT_TRUE(response);
if (response)
EXPECT_EQ(expectedUrls[i], response->url());
@@ -519,10 +519,10 @@ TEST_F(ServiceWorkerCacheTest, MatchAllAndBatchResponseTest)
result = cache->deleteFunction(scriptState(), "http://some.url/", Dictionary());
scriptValue = getResolveValue(result);
- responses = toNativeArray<v8::Handle<v8::Value> >(scriptValue.v8Value(), 0, isolate());
+ responses = toImplArray<v8::Handle<v8::Value> >(scriptValue.v8Value(), 0, isolate());
EXPECT_EQ(expectedUrls.size(), responses.size());
for (int i = 0, minsize = std::min(expectedUrls.size(), responses.size()); i < minsize; ++i) {
- Response* response = V8Response::toNativeWithTypeCheck(isolate(), responses[i]);
+ Response* response = V8Response::toImplWithTypeCheck(isolate(), responses[i]);
EXPECT_TRUE(response);
if (response)
EXPECT_EQ(expectedUrls[i], response->url());
« no previous file with comments | « Source/modules/serviceworkers/Cache.cpp ('k') | Source/modules/serviceworkers/Request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698