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

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

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

Powered by Google App Engine
This is Rietveld 408576698