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

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

Issue 1233173002: Have ScriptPromiseResolver on the Oilpan heap always. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: tidy unit tests Created 5 years, 5 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 "config.h" 5 #include "config.h"
6 #include "modules/cachestorage/Cache.h" 6 #include "modules/cachestorage/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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 ++m_fetchCount; 47 ++m_fetchCount;
48 if (m_expectedUrl) { 48 if (m_expectedUrl) {
49 String fetchedUrl; 49 String fetchedUrl;
50 if (requestInfo.isRequest()) 50 if (requestInfo.isRequest())
51 EXPECT_EQ(*m_expectedUrl, requestInfo.getAsRequest()->url()); 51 EXPECT_EQ(*m_expectedUrl, requestInfo.getAsRequest()->url());
52 else 52 else
53 EXPECT_EQ(*m_expectedUrl, requestInfo.getAsUSVString()); 53 EXPECT_EQ(*m_expectedUrl, requestInfo.getAsUSVString());
54 } 54 }
55 55
56 if (m_response) { 56 if (m_response) {
57 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseRe solver::create(scriptState); 57 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scri ptState);
58 const ScriptPromise promise = resolver->promise(); 58 const ScriptPromise promise = resolver->promise();
59 resolver->resolve(m_response); 59 resolver->resolve(m_response);
60 m_response = nullptr; 60 m_response = nullptr;
61 return promise; 61 return promise;
62 } 62 }
63 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror(scriptState->isolate(), "Unexpected call to fetch, no response available.")) ; 63 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror(scriptState->isolate(), "Unexpected call to fetch, no response available.")) ;
64 } 64 }
65 65
66 WeakPtr<GlobalFetch::ScopedFetcher> weakPtr() 66 WeakPtr<GlobalFetch::ScopedFetcher> weakPtr()
67 { 67 {
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 643
644 ScriptPromise addResult = cache->add(scriptState(), requestToRequestInfo(req uest), exceptionState()); 644 ScriptPromise addResult = cache->add(scriptState(), requestToRequestInfo(req uest), exceptionState());
645 645
646 EXPECT_EQ(kNotImplementedString, getRejectString(addResult)); 646 EXPECT_EQ(kNotImplementedString, getRejectString(addResult));
647 EXPECT_EQ(1, fetcher()->fetchCount()); 647 EXPECT_EQ(1, fetcher()->fetchCount());
648 EXPECT_EQ("dispatchBatch", testCache->getAndClearLastErrorWebCacheMethodCall ed()); 648 EXPECT_EQ("dispatchBatch", testCache->getAndClearLastErrorWebCacheMethodCall ed());
649 } 649 }
650 650
651 } // namespace 651 } // namespace
652 } // namespace blink 652 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698