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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 ThreadState::Current()->CollectAllGarbage(); | 85 ThreadState::Current()->CollectAllGarbage(); |
86 EXPECT_EQ(1u, set.size()); | 86 EXPECT_EQ(1u, set.size()); |
87 | 87 |
88 Persistent<IDBRequest> request = IDBRequest::Create( | 88 Persistent<IDBRequest> request = IDBRequest::Create( |
89 scope.GetScriptState(), IDBAny::CreateUndefined(), transaction.Get()); | 89 scope.GetScriptState(), IDBAny::CreateUndefined(), transaction.Get()); |
90 DeactivateNewTransactions(scope.GetIsolate()); | 90 DeactivateNewTransactions(scope.GetIsolate()); |
91 | 91 |
92 ThreadState::Current()->CollectAllGarbage(); | 92 ThreadState::Current()->CollectAllGarbage(); |
93 EXPECT_EQ(1u, set.size()); | 93 EXPECT_EQ(1u, set.size()); |
94 | 94 |
95 // This will generate an abort() call to the back end which is dropped by the | 95 // This will generate an Abort() call to the back end which is dropped by the |
96 // fake proxy, so an explicit onAbort call is made. | 96 // fake proxy, so an explicit OnAbort call is made. |
97 scope.GetExecutionContext()->NotifyContextDestroyed(); | 97 scope.GetExecutionContext()->NotifyContextDestroyed(); |
98 transaction->OnAbort(DOMException::Create(kAbortError, "Aborted")); | 98 transaction->OnAbort(DOMException::Create(kAbortError, "Aborted")); |
99 transaction.Clear(); | 99 transaction.Clear(); |
100 | 100 |
101 ThreadState::Current()->CollectAllGarbage(); | 101 ThreadState::Current()->CollectAllGarbage(); |
102 EXPECT_EQ(0u, set.size()); | 102 EXPECT_EQ(0u, set.size()); |
103 } | 103 } |
104 | 104 |
105 TEST(IDBTransactionTest, TransactionFinish) { | 105 TEST(IDBTransactionTest, TransactionFinish) { |
106 V8TestingScope scope; | 106 V8TestingScope scope; |
(...skipping 29 matching lines...) Expand all Loading... |
136 EXPECT_EQ(1u, set.size()); | 136 EXPECT_EQ(1u, set.size()); |
137 | 137 |
138 // Stop the context, so events don't get queued (which would keep the | 138 // Stop the context, so events don't get queued (which would keep the |
139 // transaction alive). | 139 // transaction alive). |
140 scope.GetExecutionContext()->NotifyContextDestroyed(); | 140 scope.GetExecutionContext()->NotifyContextDestroyed(); |
141 | 141 |
142 // Fire an abort to make sure this doesn't free the transaction during use. | 142 // Fire an abort to make sure this doesn't free the transaction during use. |
143 // The test will not fail if it is, but ASAN would notice the error. | 143 // The test will not fail if it is, but ASAN would notice the error. |
144 db->OnAbort(kTransactionId, DOMException::Create(kAbortError, "Aborted")); | 144 db->OnAbort(kTransactionId, DOMException::Create(kAbortError, "Aborted")); |
145 | 145 |
146 // onAbort() should have cleared the transaction's reference to the database. | 146 // OnAbort() should have cleared the transaction's reference to the database. |
147 ThreadState::Current()->CollectAllGarbage(); | 147 ThreadState::Current()->CollectAllGarbage(); |
148 EXPECT_EQ(0u, set.size()); | 148 EXPECT_EQ(0u, set.size()); |
149 } | 149 } |
150 | 150 |
151 } // namespace | 151 } // namespace |
152 } // namespace blink | 152 } // namespace blink |
OLD | NEW |