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

Side by Side Diff: Source/modules/indexeddb/IDBRequestTest.cpp

Issue 332993002: Replace ContentSecurityPolicy::client() with a method returning an ExecutionContext (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/frame/csp/ContentSecurityPolicy.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 10 matching lines...) Expand all
21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #include "config.h" 26 #include "config.h"
27 #include "modules/indexeddb/IDBRequest.h" 27 #include "modules/indexeddb/IDBRequest.h"
28 28
29 #include "core/dom/DOMError.h" 29 #include "core/dom/DOMError.h"
30 #include "core/dom/Document.h" 30 #include "core/dom/Document.h"
31 #include "core/dom/SecurityContext.h"
31 #include "core/events/EventQueue.h" 32 #include "core/events/EventQueue.h"
32 #include "modules/indexeddb/IDBDatabaseCallbacks.h" 33 #include "modules/indexeddb/IDBDatabaseCallbacks.h"
33 #include "modules/indexeddb/IDBKeyRange.h" 34 #include "modules/indexeddb/IDBKeyRange.h"
34 #include "modules/indexeddb/IDBOpenDBRequest.h" 35 #include "modules/indexeddb/IDBOpenDBRequest.h"
35 #include "platform/SharedBuffer.h" 36 #include "platform/SharedBuffer.h"
36 #include "public/platform/WebBlobInfo.h" 37 #include "public/platform/WebBlobInfo.h"
37 #include "public/platform/WebIDBDatabase.h" 38 #include "public/platform/WebIDBDatabase.h"
38 #include "wtf/PassOwnPtr.h" 39 #include "wtf/PassOwnPtr.h"
39 #include <gtest/gtest.h> 40 #include <gtest/gtest.h>
40 #include <v8.h> 41 #include <v8.h>
41 42
42 using blink::WebBlobInfo; 43 using blink::WebBlobInfo;
43 using namespace WebCore; 44 using namespace WebCore;
44 45
45 namespace { 46 namespace {
46 47
47 class NullEventQueue FINAL : public EventQueue { 48 class NullEventQueue FINAL : public EventQueue {
48 public: 49 public:
49 NullEventQueue() { } 50 NullEventQueue() { }
50 virtual ~NullEventQueue() { } 51 virtual ~NullEventQueue() { }
51 virtual bool enqueueEvent(PassRefPtrWillBeRawPtr<Event>) OVERRIDE { return t rue; } 52 virtual bool enqueueEvent(PassRefPtrWillBeRawPtr<Event>) OVERRIDE { return t rue; }
52 virtual bool cancelEvent(Event*) OVERRIDE { return true; } 53 virtual bool cancelEvent(Event*) OVERRIDE { return true; }
53 virtual void close() OVERRIDE { } 54 virtual void close() OVERRIDE { }
54 }; 55 };
55 56
56 class NullExecutionContext FINAL : public RefCountedWillBeGarbageCollectedFinali zed<NullExecutionContext>, public ExecutionContext { 57 class NullExecutionContext FINAL : public RefCountedWillBeGarbageCollectedFinali zed<NullExecutionContext>, public SecurityContext, public ExecutionContext {
57 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(NullExecutionContext); 58 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(NullExecutionContext);
58 public: 59 public:
59 NullExecutionContext(); 60 NullExecutionContext();
60 61
61 virtual EventQueue* eventQueue() const OVERRIDE { return m_queue.get(); } 62 virtual EventQueue* eventQueue() const OVERRIDE { return m_queue.get(); }
62 63
63 void trace(Visitor* visitor) 64 void trace(Visitor* visitor)
64 { 65 {
65 visitor->trace(m_queue); 66 visitor->trace(m_queue);
66 ExecutionContext::trace(visitor); 67 ExecutionContext::trace(visitor);
67 } 68 }
68 69
69 #if !ENABLE(OILPAN) 70 #if !ENABLE(OILPAN)
70 using RefCounted<NullExecutionContext>::ref; 71 using RefCounted<NullExecutionContext>::ref;
71 using RefCounted<NullExecutionContext>::deref; 72 using RefCounted<NullExecutionContext>::deref;
72 73
74 virtual void reportBlockedScriptExecutionToInspector(const String& directive Text) OVERRIDE { }
75
76 virtual SecurityContext& securityContext() { return *this; }
77
73 virtual void refExecutionContext() OVERRIDE { ref(); } 78 virtual void refExecutionContext() OVERRIDE { ref(); }
74 virtual void derefExecutionContext() OVERRIDE { deref(); } 79 virtual void derefExecutionContext() OVERRIDE { deref(); }
75 #endif 80 #endif
76 81
82 protected:
83 virtual const KURL& virtualURL() const OVERRIDE { return m_dummyURL; }
84 virtual KURL virtualCompleteURL(const String&) const OVERRIDE { return m_dum myURL; }
85
77 private: 86 private:
78 OwnPtrWillBeMember<EventQueue> m_queue; 87 OwnPtrWillBeMember<EventQueue> m_queue;
88
89 KURL m_dummyURL;
79 }; 90 };
80 91
81 NullExecutionContext::NullExecutionContext() 92 NullExecutionContext::NullExecutionContext()
82 : m_queue(adoptPtrWillBeNoop(new NullEventQueue())) 93 : m_queue(adoptPtrWillBeNoop(new NullEventQueue()))
83 { 94 {
84 } 95 }
85 96
86 class IDBRequestTest : public testing::Test { 97 class IDBRequestTest : public testing::Test {
87 public: 98 public:
88 IDBRequestTest() 99 IDBRequestTest()
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 OwnPtr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create(); 197 OwnPtr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create();
187 IDBOpenDBRequest* request = IDBOpenDBRequest::create(scriptState(), call backs, transactionId, version); 198 IDBOpenDBRequest* request = IDBOpenDBRequest::create(scriptState(), call backs, transactionId, version);
188 EXPECT_EQ(request->readyState(), "pending"); 199 EXPECT_EQ(request->readyState(), "pending");
189 200
190 executionContext()->stopActiveDOMObjects(); 201 executionContext()->stopActiveDOMObjects();
191 request->onSuccess(backend.release(), metadata); 202 request->onSuccess(backend.release(), metadata);
192 } 203 }
193 } 204 }
194 205
195 } // namespace 206 } // namespace
OLDNEW
« no previous file with comments | « Source/core/frame/csp/ContentSecurityPolicy.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698