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

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

Issue 2815313002: Reland of Move ScriptState::GetExecutionContext (Part 5) (Closed)
Patch Set: Created 3 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 <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include "bindings/core/v8/ExceptionState.h" 10 #include "bindings/core/v8/ExceptionState.h"
11 #include "bindings/core/v8/ScriptFunction.h" 11 #include "bindings/core/v8/ScriptFunction.h"
12 #include "bindings/core/v8/ScriptPromise.h" 12 #include "bindings/core/v8/ScriptPromise.h"
13 #include "bindings/core/v8/ScriptPromiseResolver.h" 13 #include "bindings/core/v8/ScriptPromiseResolver.h"
14 #include "bindings/core/v8/ScriptValue.h" 14 #include "bindings/core/v8/ScriptValue.h"
15 #include "bindings/core/v8/V8Binding.h" 15 #include "bindings/core/v8/V8Binding.h"
16 #include "bindings/modules/v8/V8Request.h" 16 #include "bindings/modules/v8/V8Request.h"
17 #include "bindings/modules/v8/V8Response.h" 17 #include "bindings/modules/v8/V8Response.h"
18 #include "core/dom/Document.h" 18 #include "core/dom/Document.h"
19 #include "core/dom/ExecutionContext.h"
19 #include "core/frame/Frame.h" 20 #include "core/frame/Frame.h"
20 #include "core/testing/DummyPageHolder.h" 21 #include "core/testing/DummyPageHolder.h"
21 #include "modules/fetch/BodyStreamBuffer.h" 22 #include "modules/fetch/BodyStreamBuffer.h"
22 #include "modules/fetch/FormDataBytesConsumer.h" 23 #include "modules/fetch/FormDataBytesConsumer.h"
23 #include "modules/fetch/GlobalFetch.h" 24 #include "modules/fetch/GlobalFetch.h"
24 #include "modules/fetch/Request.h" 25 #include "modules/fetch/Request.h"
25 #include "modules/fetch/Response.h" 26 #include "modules/fetch/Response.h"
26 #include "modules/fetch/ResponseInit.h" 27 #include "modules/fetch/ResponseInit.h"
27 #include "platform/wtf/PtrUtil.h" 28 #include "platform/wtf/PtrUtil.h"
28 #include "public/platform/WebURLResponse.h" 29 #include "public/platform/WebURLResponse.h"
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 238
238 Cache* CreateCache(ScopedFetcherForTests* fetcher, 239 Cache* CreateCache(ScopedFetcherForTests* fetcher,
239 WebServiceWorkerCache* web_cache) { 240 WebServiceWorkerCache* web_cache) {
240 return Cache::Create(fetcher, WTF::WrapUnique(web_cache)); 241 return Cache::Create(fetcher, WTF::WrapUnique(web_cache));
241 } 242 }
242 243
243 ScriptState* GetScriptState() { 244 ScriptState* GetScriptState() {
244 return ToScriptStateForMainWorld(page_->GetDocument().GetFrame()); 245 return ToScriptStateForMainWorld(page_->GetDocument().GetFrame());
245 } 246 }
246 ExecutionContext* GetExecutionContext() { 247 ExecutionContext* GetExecutionContext() {
247 return GetScriptState()->GetExecutionContext(); 248 return ExecutionContext::From(GetScriptState());
248 } 249 }
249 v8::Isolate* GetIsolate() { return GetScriptState()->GetIsolate(); } 250 v8::Isolate* GetIsolate() { return GetScriptState()->GetIsolate(); }
250 v8::Local<v8::Context> GetContext() { return GetScriptState()->GetContext(); } 251 v8::Local<v8::Context> GetContext() { return GetScriptState()->GetContext(); }
251 252
252 Request* NewRequestFromUrl(const String& url) { 253 Request* NewRequestFromUrl(const String& url) {
253 DummyExceptionStateForTesting exception_state; 254 DummyExceptionStateForTesting exception_state;
254 Request* request = Request::Create(GetScriptState(), url, exception_state); 255 Request* request = Request::Create(GetScriptState(), url, exception_state);
255 EXPECT_FALSE(exception_state.HadException()); 256 EXPECT_FALSE(exception_state.HadException());
256 return exception_state.HadException() ? 0 : request; 257 return exception_state.HadException() ? 0 : request;
257 } 258 }
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 733
733 EXPECT_EQ(kNotImplementedString, GetRejectString(add_result)); 734 EXPECT_EQ(kNotImplementedString, GetRejectString(add_result));
734 EXPECT_EQ(1, fetcher->FetchCount()); 735 EXPECT_EQ(1, fetcher->FetchCount());
735 EXPECT_EQ("dispatchBatch", 736 EXPECT_EQ("dispatchBatch",
736 test_cache->GetAndClearLastErrorWebCacheMethodCalled()); 737 test_cache->GetAndClearLastErrorWebCacheMethodCalled());
737 } 738 }
738 739
739 } // namespace 740 } // namespace
740 741
741 } // namespace blink 742 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698