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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 void deactivateNewTransactions() | 64 void deactivateNewTransactions() |
65 { | 65 { |
66 V8PerIsolateData::from(isolate())->ensureIDBPendingTransactionMonitor()-
>deactivateNewTransactions(); | 66 V8PerIsolateData::from(isolate())->ensureIDBPendingTransactionMonitor()-
>deactivateNewTransactions(); |
67 } | 67 } |
68 | 68 |
69 private: | 69 private: |
70 V8TestingScope m_scope; | 70 V8TestingScope m_scope; |
71 RefPtrWillBePersistent<ExecutionContext> m_executionContext; | 71 RefPtrWillBePersistent<ExecutionContext> m_executionContext; |
72 }; | 72 }; |
73 | 73 |
74 class FakeWebIDBDatabase FINAL : public WebIDBDatabase { | 74 class FakeWebIDBDatabase final : public WebIDBDatabase { |
75 public: | 75 public: |
76 static PassOwnPtr<FakeWebIDBDatabase> create() { return adoptPtr(new FakeWeb
IDBDatabase()); } | 76 static PassOwnPtr<FakeWebIDBDatabase> create() { return adoptPtr(new FakeWeb
IDBDatabase()); } |
77 | 77 |
78 virtual void commit(long long transactionId) OVERRIDE { } | 78 virtual void commit(long long transactionId) override { } |
79 virtual void abort(long long transactionId) OVERRIDE { } | 79 virtual void abort(long long transactionId) override { } |
80 virtual void close() OVERRIDE { } | 80 virtual void close() override { } |
81 | 81 |
82 private: | 82 private: |
83 FakeWebIDBDatabase() { } | 83 FakeWebIDBDatabase() { } |
84 }; | 84 }; |
85 | 85 |
86 class FakeIDBDatabaseCallbacks FINAL : public IDBDatabaseCallbacks { | 86 class FakeIDBDatabaseCallbacks final : public IDBDatabaseCallbacks { |
87 public: | 87 public: |
88 static FakeIDBDatabaseCallbacks* create() { return new FakeIDBDatabaseCallba
cks(); } | 88 static FakeIDBDatabaseCallbacks* create() { return new FakeIDBDatabaseCallba
cks(); } |
89 virtual void onVersionChange(int64_t oldVersion, int64_t newVersion) OVERRID
E { } | 89 virtual void onVersionChange(int64_t oldVersion, int64_t newVersion) overrid
e { } |
90 virtual void onForcedClose() OVERRIDE { } | 90 virtual void onForcedClose() override { } |
91 virtual void onAbort(int64_t transactionId, DOMError* error) OVERRIDE { } | 91 virtual void onAbort(int64_t transactionId, DOMError* error) override { } |
92 virtual void onComplete(int64_t transactionId) OVERRIDE { } | 92 virtual void onComplete(int64_t transactionId) override { } |
93 private: | 93 private: |
94 FakeIDBDatabaseCallbacks() { } | 94 FakeIDBDatabaseCallbacks() { } |
95 }; | 95 }; |
96 | 96 |
97 TEST_F(IDBTransactionTest, EnsureLifetime) | 97 TEST_F(IDBTransactionTest, EnsureLifetime) |
98 { | 98 { |
99 OwnPtr<FakeWebIDBDatabase> backend = FakeWebIDBDatabase::create(); | 99 OwnPtr<FakeWebIDBDatabase> backend = FakeWebIDBDatabase::create(); |
100 Persistent<IDBDatabase> db = IDBDatabase::create(executionContext(), backend
.release(), FakeIDBDatabaseCallbacks::create()); | 100 Persistent<IDBDatabase> db = IDBDatabase::create(executionContext(), backend
.release(), FakeIDBDatabaseCallbacks::create()); |
101 | 101 |
102 const int64_t transactionId = 1234; | 102 const int64_t transactionId = 1234; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 // will not fail if it is, but ASAN would notice the error. | 155 // will not fail if it is, but ASAN would notice the error. |
156 db->onAbort(transactionId, DOMError::create(AbortError, "Aborted")); | 156 db->onAbort(transactionId, DOMError::create(AbortError, "Aborted")); |
157 | 157 |
158 // onAbort() should have cleared the transaction's reference to the database
. | 158 // onAbort() should have cleared the transaction's reference to the database
. |
159 Heap::collectAllGarbage(); | 159 Heap::collectAllGarbage(); |
160 EXPECT_EQ(0u, set.size()); | 160 EXPECT_EQ(0u, set.size()); |
161 } | 161 } |
162 | 162 |
163 } // namespace | 163 } // namespace |
164 } // namespace blink | 164 } // namespace blink |
OLD | NEW |