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