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(V8TestingScope::create(v8::Isolate::GetCurrent())) | 53 : m_scope(v8::Isolate::GetCurrent()) |
54 { | 54 { |
55 m_scope->scriptState()->setExecutionContext(Document::create()); | 55 m_scope.scriptState()->setExecutionContext(Document::create()); |
56 } | 56 } |
57 | 57 |
58 v8::Isolate* isolate() const { return m_scope->isolate(); } | 58 v8::Isolate* isolate() const { return m_scope.isolate(); } |
59 ScriptState* scriptState() const { return m_scope->scriptState(); } | 59 ScriptState* scriptState() const { return m_scope.scriptState(); } |
60 ExecutionContext* executionContext() { return m_scope->scriptState()->execut
ionContext(); } | 60 ExecutionContext* executionContext() { return m_scope.scriptState()->executi
onContext(); } |
61 | 61 |
62 private: | 62 private: |
63 OwnPtr<V8TestingScope> m_scope; | 63 V8TestingScope m_scope; |
64 }; | 64 }; |
65 | 65 |
66 class FakeWebIDBDatabase FINAL : public blink::WebIDBDatabase { | 66 class FakeWebIDBDatabase FINAL : public blink::WebIDBDatabase { |
67 public: | 67 public: |
68 static PassOwnPtr<FakeWebIDBDatabase> create() { return adoptPtr(new FakeWeb
IDBDatabase()); } | 68 static PassOwnPtr<FakeWebIDBDatabase> create() { return adoptPtr(new FakeWeb
IDBDatabase()); } |
69 | 69 |
70 virtual void commit(long long transactionId) OVERRIDE { } | 70 virtual void commit(long long transactionId) OVERRIDE { } |
71 virtual void abort(long long transactionId) OVERRIDE { } | 71 virtual void abort(long long transactionId) OVERRIDE { } |
72 virtual void close() OVERRIDE { } | 72 virtual void close() OVERRIDE { } |
73 | 73 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 // Fire an abort to make sure this doesn't free the transaction during use.
The test | 146 // Fire an abort to make sure this doesn't free the transaction during use.
The test |
147 // will not fail if it is, but ASAN would notice the error. | 147 // will not fail if it is, but ASAN would notice the error. |
148 db->onAbort(transactionId, DOMError::create(AbortError, "Aborted")); | 148 db->onAbort(transactionId, DOMError::create(AbortError, "Aborted")); |
149 | 149 |
150 // onAbort() should have cleared the transaction's reference to the database
. | 150 // onAbort() should have cleared the transaction's reference to the database
. |
151 Heap::collectAllGarbage(); | 151 Heap::collectAllGarbage(); |
152 EXPECT_EQ(0u, set.size()); | 152 EXPECT_EQ(0u, set.size()); |
153 } | 153 } |
154 | 154 |
155 } // namespace | 155 } // namespace |
OLD | NEW |