OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 | 43 |
44 using namespace WebCore; | 44 using namespace WebCore; |
45 | 45 |
46 using blink::WebIDBDatabase; | 46 using blink::WebIDBDatabase; |
47 | 47 |
48 namespace { | 48 namespace { |
49 | 49 |
50 class IDBTransactionTest : public testing::Test { | 50 class IDBTransactionTest : public testing::Test { |
51 public: | 51 public: |
52 IDBTransactionTest() | 52 IDBTransactionTest() |
53 : m_scope(V8ExecutionScope::create(v8::Isolate::GetCurrent())) | 53 : m_scope(V8TestingScope::create(v8::Isolate::GetCurrent())) |
54 , m_document(Document::create()) | |
55 { | 54 { |
55 m_scope->scriptState()->setExecutionContext(Document::create()); | |
56 } | 56 } |
57 | 57 |
58 v8::Isolate* isolate() const { return m_scope->isolate(); } | |
59 | |
58 ExecutionContext* executionContext() | 60 ExecutionContext* executionContext() |
59 { | 61 { |
60 return m_document.get(); | 62 return m_scope->scriptState()->executionContext(); |
61 } | 63 } |
62 | 64 |
63 private: | 65 private: |
64 OwnPtr<V8ExecutionScope> m_scope; | 66 OwnPtr<V8TestingScope> m_scope; |
65 RefPtr<Document> m_document; | |
66 }; | 67 }; |
67 | 68 |
68 class FakeWebIDBDatabase FINAL : public blink::WebIDBDatabase { | 69 class FakeWebIDBDatabase FINAL : public blink::WebIDBDatabase { |
69 public: | 70 public: |
70 static PassOwnPtr<FakeWebIDBDatabase> create() { return adoptPtr(new FakeWeb IDBDatabase()); } | 71 static PassOwnPtr<FakeWebIDBDatabase> create() { return adoptPtr(new FakeWeb IDBDatabase()); } |
71 | 72 |
72 virtual void commit(long long transactionId) OVERRIDE { } | 73 virtual void commit(long long transactionId) OVERRIDE { } |
73 virtual void abort(long long transactionId) OVERRIDE { } | 74 virtual void abort(long long transactionId) OVERRIDE { } |
74 virtual void close() OVERRIDE { } | 75 virtual void close() OVERRIDE { } |
75 | 76 |
(...skipping 24 matching lines...) Expand all Loading... | |
100 PersistentHeapHashSet<WeakMember<IDBTransaction> > set; | 101 PersistentHeapHashSet<WeakMember<IDBTransaction> > set; |
101 set.add(transaction); | 102 set.add(transaction); |
102 | 103 |
103 Heap::collectAllGarbage(); | 104 Heap::collectAllGarbage(); |
104 EXPECT_EQ(1u, set.size()); | 105 EXPECT_EQ(1u, set.size()); |
105 #else | 106 #else |
106 // Local reference, IDBDatabase's reference and IDBPendingTransactionMonitor 's reference: | 107 // Local reference, IDBDatabase's reference and IDBPendingTransactionMonitor 's reference: |
107 EXPECT_EQ(3, transaction->refCount()); | 108 EXPECT_EQ(3, transaction->refCount()); |
108 #endif | 109 #endif |
109 | 110 |
110 RefPtrWillBePersistent<IDBRequest> request = IDBRequest::create(executionCon text(), IDBAny::createUndefined(), transaction.get()); | 111 RefPtrWillBePersistent<IDBRequest> request = IDBRequest::create(ScriptState: :current(isolate()), IDBAny::createUndefined(), transaction.get()); |
jsbell
2014/05/27 18:38:47
Just isolate() here rather than ScriptState::curre
haraken
2014/05/28 00:35:49
Done.
| |
111 IDBPendingTransactionMonitor::from(*executionContext()).deactivateNewTransac tions(); | 112 IDBPendingTransactionMonitor::from(*executionContext()).deactivateNewTransac tions(); |
112 | 113 |
113 #if ENABLE(OILPAN) | 114 #if ENABLE(OILPAN) |
114 Heap::collectAllGarbage(); | 115 Heap::collectAllGarbage(); |
115 EXPECT_EQ(1u, set.size()); | 116 EXPECT_EQ(1u, set.size()); |
116 #else | 117 #else |
117 // Local reference and IDBDatabase's reference., and the IDBRequest's refer ence | 118 // Local reference and IDBDatabase's reference., and the IDBRequest's refer ence |
118 EXPECT_EQ(3, transaction->refCount()); | 119 EXPECT_EQ(3, transaction->refCount()); |
119 #endif | 120 #endif |
120 | 121 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
184 // onAbort() should have cleared the transaction's reference to the database . | 185 // onAbort() should have cleared the transaction's reference to the database . |
185 #if ENABLE(OILPAN) | 186 #if ENABLE(OILPAN) |
186 Heap::collectAllGarbage(); | 187 Heap::collectAllGarbage(); |
187 EXPECT_EQ(0u, set.size()); | 188 EXPECT_EQ(0u, set.size()); |
188 #else | 189 #else |
189 EXPECT_EQ(1, db->refCount()); | 190 EXPECT_EQ(1, db->refCount()); |
190 #endif | 191 #endif |
191 } | 192 } |
192 | 193 |
193 } // namespace | 194 } // namespace |
OLD | NEW |