Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: third_party/WebKit/Source/modules/indexeddb/IDBTransactionTest.cpp

Issue 1978173002: Remove OwnPtr::release() calls in modules/ (part 2). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 void onComplete(int64_t transactionId) override { } 86 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<MockWebIDBDatabase> backend = MockWebIDBDatabase::create(); 93 OwnPtr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create();
94 EXPECT_CALL(*backend, close()) 94 EXPECT_CALL(*backend, close())
95 .Times(1); 95 .Times(1);
96 Persistent<IDBDatabase> db = IDBDatabase::create(getExecutionContext(), back end.release(), FakeIDBDatabaseCallbacks::create()); 96 Persistent<IDBDatabase> db = IDBDatabase::create(getExecutionContext(), std: :move(backend), FakeIDBDatabaseCallbacks::create());
97 97
98 const int64_t transactionId = 1234; 98 const int64_t transactionId = 1234;
99 const HashSet<String> transactionScope = HashSet<String>(); 99 const HashSet<String> transactionScope = HashSet<String>();
100 Persistent<IDBTransaction> transaction = IDBTransaction::create(getScriptSta te(), transactionId, transactionScope, WebIDBTransactionModeReadOnly, db.get()); 100 Persistent<IDBTransaction> transaction = IDBTransaction::create(getScriptSta te(), transactionId, transactionScope, WebIDBTransactionModeReadOnly, db.get());
101 PersistentHeapHashSet<WeakMember<IDBTransaction>> set; 101 PersistentHeapHashSet<WeakMember<IDBTransaction>> set;
102 set.add(transaction); 102 set.add(transaction);
103 103
104 ThreadHeap::collectAllGarbage(); 104 ThreadHeap::collectAllGarbage();
105 EXPECT_EQ(1u, set.size()); 105 EXPECT_EQ(1u, set.size());
106 106
(...skipping 15 matching lines...) Expand all
122 122
123 TEST_F(IDBTransactionTest, TransactionFinish) 123 TEST_F(IDBTransactionTest, TransactionFinish)
124 { 124 {
125 const int64_t transactionId = 1234; 125 const int64_t transactionId = 1234;
126 126
127 OwnPtr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create(); 127 OwnPtr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create();
128 EXPECT_CALL(*backend, commit(transactionId)) 128 EXPECT_CALL(*backend, commit(transactionId))
129 .Times(1); 129 .Times(1);
130 EXPECT_CALL(*backend, close()) 130 EXPECT_CALL(*backend, close())
131 .Times(1); 131 .Times(1);
132 Persistent<IDBDatabase> db = IDBDatabase::create(getExecutionContext(), back end.release(), FakeIDBDatabaseCallbacks::create()); 132 Persistent<IDBDatabase> db = IDBDatabase::create(getExecutionContext(), std: :move(backend), FakeIDBDatabaseCallbacks::create());
133 133
134 const HashSet<String> transactionScope = HashSet<String>(); 134 const HashSet<String> transactionScope = HashSet<String>();
135 Persistent<IDBTransaction> transaction = IDBTransaction::create(getScriptSta te(), transactionId, transactionScope, WebIDBTransactionModeReadOnly, db.get()); 135 Persistent<IDBTransaction> transaction = IDBTransaction::create(getScriptSta te(), transactionId, transactionScope, WebIDBTransactionModeReadOnly, db.get());
136 PersistentHeapHashSet<WeakMember<IDBTransaction>> set; 136 PersistentHeapHashSet<WeakMember<IDBTransaction>> set;
137 set.add(transaction); 137 set.add(transaction);
138 138
139 ThreadHeap::collectAllGarbage(); 139 ThreadHeap::collectAllGarbage();
140 EXPECT_EQ(1u, set.size()); 140 EXPECT_EQ(1u, set.size());
141 141
142 deactivateNewTransactions(); 142 deactivateNewTransactions();
(...skipping 13 matching lines...) Expand all
156 // will not fail if it is, but ASAN would notice the error. 156 // will not fail if it is, but ASAN would notice the error.
157 db->onAbort(transactionId, DOMException::create(AbortError, "Aborted")); 157 db->onAbort(transactionId, DOMException::create(AbortError, "Aborted"));
158 158
159 // onAbort() should have cleared the transaction's reference to the database . 159 // onAbort() should have cleared the transaction's reference to the database .
160 ThreadHeap::collectAllGarbage(); 160 ThreadHeap::collectAllGarbage();
161 EXPECT_EQ(0u, set.size()); 161 EXPECT_EQ(0u, set.size());
162 } 162 }
163 163
164 } // namespace 164 } // namespace
165 } // namespace blink 165 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698