| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 private: | 76 private: |
| 77 FakeWebIDBDatabase() { } | 77 FakeWebIDBDatabase() { } |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 class FakeIDBDatabaseCallbacks FINAL : public IDBDatabaseCallbacks { | 80 class FakeIDBDatabaseCallbacks FINAL : public IDBDatabaseCallbacks { |
| 81 public: | 81 public: |
| 82 static PassRefPtr<FakeIDBDatabaseCallbacks> create() { return adoptRef(new F
akeIDBDatabaseCallbacks()); } | 82 static PassRefPtr<FakeIDBDatabaseCallbacks> create() { return adoptRef(new F
akeIDBDatabaseCallbacks()); } |
| 83 virtual void onVersionChange(int64_t oldVersion, int64_t newVersion) OVERRID
E { } | 83 virtual void onVersionChange(int64_t oldVersion, int64_t newVersion) OVERRID
E { } |
| 84 virtual void onForcedClose() OVERRIDE { } | 84 virtual void onForcedClose() OVERRIDE { } |
| 85 virtual void onAbort(int64_t transactionId, PassRefPtr<DOMError> error) OVER
RIDE { } | 85 virtual void onAbort(int64_t transactionId, PassRefPtrWillBeRawPtr<DOMError>
error) OVERRIDE { } |
| 86 virtual void onComplete(int64_t transactionId) OVERRIDE { } | 86 virtual void onComplete(int64_t transactionId) OVERRIDE { } |
| 87 private: | 87 private: |
| 88 FakeIDBDatabaseCallbacks() { } | 88 FakeIDBDatabaseCallbacks() { } |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 TEST_F(IDBTransactionTest, EnsureLifetime) | 91 TEST_F(IDBTransactionTest, EnsureLifetime) |
| 92 { | 92 { |
| 93 OwnPtr<FakeWebIDBDatabase> backend = FakeWebIDBDatabase::create(); | 93 OwnPtr<FakeWebIDBDatabase> backend = FakeWebIDBDatabase::create(); |
| 94 RefPtr<FakeIDBDatabaseCallbacks> connection = FakeIDBDatabaseCallbacks::crea
te(); | 94 RefPtr<FakeIDBDatabaseCallbacks> connection = FakeIDBDatabaseCallbacks::crea
te(); |
| 95 RefPtr<IDBDatabase> db = IDBDatabase::create(executionContext(), backend.rel
ease(), connection); | 95 RefPtr<IDBDatabase> db = IDBDatabase::create(executionContext(), backend.rel
ease(), connection); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 | 144 |
| 145 // Fire an abort to make sure this doesn't free the transaction during use.
The test | 145 // Fire an abort to make sure this doesn't free the transaction during use.
The test |
| 146 // will not fail if it is, but ASAN would notice the error. | 146 // will not fail if it is, but ASAN would notice the error. |
| 147 db->onAbort(transactionId, DOMError::create(AbortError, "Aborted")); | 147 db->onAbort(transactionId, DOMError::create(AbortError, "Aborted")); |
| 148 | 148 |
| 149 // onAbort() should have cleared the transaction's reference to the database
. | 149 // onAbort() should have cleared the transaction's reference to the database
. |
| 150 EXPECT_EQ(1, db->refCount()); | 150 EXPECT_EQ(1, db->refCount()); |
| 151 } | 151 } |
| 152 | 152 |
| 153 } // namespace | 153 } // namespace |
| OLD | NEW |