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

Side by Side Diff: content/browser/indexed_db/indexed_db_unittest.cc

Issue 2104383002: Avoid using a cast for a overload selection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase to land Created 4 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdint.h> 5 #include <stdint.h>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 temp_dir.path(), special_storage_policy_.get(), 239 temp_dir.path(), special_storage_policy_.get(),
240 quota_manager_proxy_.get(), task_runner_.get()); 240 quota_manager_proxy_.get(), task_runner_.get());
241 241
242 base::FilePath test_path = idb_context->GetFilePathForTesting(kTestOrigin); 242 base::FilePath test_path = idb_context->GetFilePathForTesting(kTestOrigin);
243 ASSERT_TRUE(base::CreateDirectory(test_path)); 243 ASSERT_TRUE(base::CreateDirectory(test_path));
244 244
245 std::unique_ptr<LevelDBLock> lock = 245 std::unique_ptr<LevelDBLock> lock =
246 LevelDBDatabase::LockForTesting(test_path); 246 LevelDBDatabase::LockForTesting(test_path);
247 ASSERT_TRUE(lock); 247 ASSERT_TRUE(lock);
248 248
249 // TODO(jsbell): Remove static_cast<> when overloads are eliminated. 249 // TODO(jsbell): Remove static_cast<> when overloads are eliminated.
jsbell 2016/07/07 16:49:05 Would have been nice to eliminate the comment too.
250 void (IndexedDBContextImpl::* delete_for_origin)(const Origin&) =
251 &IndexedDBContextImpl::DeleteForOrigin;
250 idb_context->TaskRunner()->PostTask( 252 idb_context->TaskRunner()->PostTask(
251 FROM_HERE, 253 FROM_HERE,
252 base::Bind(static_cast<void (IndexedDBContextImpl::*)(const Origin&)>( 254 base::Bind(delete_for_origin, idb_context, kTestOrigin));
253 &IndexedDBContextImpl::DeleteForOrigin),
254 idb_context, kTestOrigin));
255 FlushIndexedDBTaskRunner(); 255 FlushIndexedDBTaskRunner();
256 256
257 EXPECT_TRUE(base::DirectoryExists(test_path)); 257 EXPECT_TRUE(base::DirectoryExists(test_path));
258 } 258 }
259 259
260 TEST_F(IndexedDBTest, ForceCloseOpenDatabasesOnCommitFailure) { 260 TEST_F(IndexedDBTest, ForceCloseOpenDatabasesOnCommitFailure) {
261 const Origin kTestOrigin(GURL("http://test/")); 261 const Origin kTestOrigin(GURL("http://test/"));
262 262
263 base::ScopedTempDir temp_dir; 263 base::ScopedTempDir temp_dir;
264 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 264 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
(...skipping 25 matching lines...) Expand all
290 290
291 // Simulate the write failure. 291 // Simulate the write failure.
292 leveldb::Status status = leveldb::Status::IOError("Simulated failure"); 292 leveldb::Status status = leveldb::Status::IOError("Simulated failure");
293 callbacks->connection()->database()->TransactionCommitFailed(status); 293 callbacks->connection()->database()->TransactionCommitFailed(status);
294 294
295 EXPECT_TRUE(db_callbacks->forced_close_called()); 295 EXPECT_TRUE(db_callbacks->forced_close_called());
296 EXPECT_FALSE(factory->IsBackingStoreOpen(kTestOrigin)); 296 EXPECT_FALSE(factory->IsBackingStoreOpen(kTestOrigin));
297 } 297 }
298 298
299 } // namespace content 299 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698