OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |