Commit 76e64e4c authored by Kevin McNee's avatar Kevin McNee Committed by Commit Bot

Use static_cast instead of reinterpret_cast for downcasting

static_cast is better suited for downcasting since it can check that the
types are related.

/content/browser/appcache
This CL was uploaded by git cl split.

R=mek@chromium.org

Change-Id: Ic95365fb8db7002cb97aa7b2a3a22ac6173e37d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2435700
Auto-Submit: Kevin McNee <mcnee@chromium.org>
Reviewed-by: default avatarMarijn Kruisselbrink <mek@chromium.org>
Commit-Queue: Marijn Kruisselbrink <mek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811330}
parent cdd3b3b8
......@@ -691,7 +691,7 @@ class AppCacheRequestHandlerTest : public ::testing::Test {
void OnBadMessage(const std::string& reason) { NOTREACHED(); }
MockAppCacheStorage* mock_storage() {
return reinterpret_cast<MockAppCacheStorage*>(mock_service_->storage());
return static_cast<MockAppCacheStorage*>(mock_service_->storage());
}
void CreateRequestAndHandler(const GURL& url,
......
......@@ -2463,7 +2463,7 @@ class AppCacheUpdateJobTest : public testing::Test,
void FailStoreNewestCacheTest() {
MakeService();
MockAppCacheStorage* storage =
reinterpret_cast<MockAppCacheStorage*>(service_->storage());
static_cast<MockAppCacheStorage*>(service_->storage());
storage->SimulateStoreGroupAndNewestCacheFailure();
group_ = base::MakeRefCounted<AppCacheGroup>(
......@@ -2490,7 +2490,7 @@ class AppCacheUpdateJobTest : public testing::Test,
void UpgradeFailStoreNewestCacheTest() {
MakeService();
MockAppCacheStorage* storage =
reinterpret_cast<MockAppCacheStorage*>(service_->storage());
static_cast<MockAppCacheStorage*>(service_->storage());
storage->SimulateStoreGroupAndNewestCacheFailure();
group_ = base::MakeRefCounted<AppCacheGroup>(
......@@ -2543,7 +2543,7 @@ class AppCacheUpdateJobTest : public testing::Test,
void MasterEntryFailStoreNewestCacheTest() {
MakeService();
MockAppCacheStorage* storage =
reinterpret_cast<MockAppCacheStorage*>(service_->storage());
static_cast<MockAppCacheStorage*>(service_->storage());
storage->SimulateStoreGroupAndNewestCacheFailure();
const GURL kManifestUrl = MockHttpServer::GetMockUrl("files/notmodified");
......@@ -2589,7 +2589,7 @@ class AppCacheUpdateJobTest : public testing::Test,
void UpgradeFailMakeGroupObsoleteTest() {
MakeService();
MockAppCacheStorage* storage =
reinterpret_cast<MockAppCacheStorage*>(service_->storage());
static_cast<MockAppCacheStorage*>(service_->storage());
storage->SimulateMakeGroupObsoleteFailure();
group_ = base::MakeRefCounted<AppCacheGroup>(
......@@ -4528,7 +4528,7 @@ class AppCacheUpdateJobTest : public testing::Test,
!group_->first_evictable_error_time().is_null());
if (expect_evictable_error_) {
MockAppCacheStorage* storage =
reinterpret_cast<MockAppCacheStorage*>(service_->storage());
static_cast<MockAppCacheStorage*>(service_->storage());
EXPECT_EQ(group_->first_evictable_error_time(),
storage->stored_eviction_times_[group_->group_id()].second);
}
......@@ -4563,7 +4563,7 @@ class AppCacheUpdateJobTest : public testing::Test,
// is unknown to the test). Check group and newest cache were stored
// when update succeeds.
MockAppCacheStorage* storage =
reinterpret_cast<MockAppCacheStorage*>(service_->storage());
static_cast<MockAppCacheStorage*>(service_->storage());
EXPECT_TRUE(storage->IsGroupStored(group_.get()));
EXPECT_TRUE(storage->IsCacheStored(group_->newest_complete_cache()));
......
......@@ -123,7 +123,7 @@ TEST_F(MockAppCacheStorageTest, CreateGroup) {
// Should complete asyncly.
MockAppCacheService service;
MockAppCacheStorage* storage =
reinterpret_cast<MockAppCacheStorage*>(service.storage());
static_cast<MockAppCacheStorage*>(service.storage());
MockStorageDelegate delegate;
GURL manifest_url("http://blah/");
service.storage()->LoadOrCreateGroup(manifest_url, &delegate);
......@@ -169,7 +169,7 @@ TEST_F(MockAppCacheStorageTest, LoadGroupAndCache_FarHit) {
// load should complete asyncly.
MockAppCacheService service;
MockAppCacheStorage* storage =
reinterpret_cast<MockAppCacheStorage*>(service.storage());
static_cast<MockAppCacheStorage*>(service.storage());
// Setup some preconditions. Create a group and newest cache that
// appears to be "stored" and "not currently in use".
......@@ -220,7 +220,7 @@ TEST_F(MockAppCacheStorageTest, StoreNewGroup) {
// Store a group and its newest cache. Should complete asyncly.
MockAppCacheService service;
MockAppCacheStorage* storage =
reinterpret_cast<MockAppCacheStorage*>(service.storage());
static_cast<MockAppCacheStorage*>(service.storage());
// Setup some preconditions. Create a group and newest cache that
// appears to be "unstored".
......@@ -252,7 +252,7 @@ TEST_F(MockAppCacheStorageTest, StoreExistingGroup) {
// Store a group and its newest cache. Should complete asyncly.
MockAppCacheService service;
MockAppCacheStorage* storage =
reinterpret_cast<MockAppCacheStorage*>(service.storage());
static_cast<MockAppCacheStorage*>(service.storage());
// Setup some preconditions. Create a group and old complete cache
// that appear to be "stored", and a newest unstored complete cache.
......@@ -297,7 +297,7 @@ TEST_F(MockAppCacheStorageTest, StoreExistingGroupExistingCache) {
// Store a group with updates to its existing newest complete cache.
MockAppCacheService service;
MockAppCacheStorage* storage =
reinterpret_cast<MockAppCacheStorage*>(service.storage());
static_cast<MockAppCacheStorage*>(service.storage());
// Setup some preconditions. Create a group and a complete cache that
// appear to be "stored".
......@@ -339,7 +339,7 @@ TEST_F(MockAppCacheStorageTest, MakeGroupObsolete) {
// Make a group obsolete, should complete asyncly.
MockAppCacheService service;
MockAppCacheStorage* storage =
reinterpret_cast<MockAppCacheStorage*>(service.storage());
static_cast<MockAppCacheStorage*>(service.storage());
// Setup some preconditions. Create a group and newest cache that
// appears to be "stored" and "currently in use".
......@@ -384,7 +384,7 @@ TEST_F(MockAppCacheStorageTest, MarkEntryAsForeign) {
// Should complete syncly.
MockAppCacheService service;
MockAppCacheStorage* storage =
reinterpret_cast<MockAppCacheStorage*>(service.storage());
static_cast<MockAppCacheStorage*>(service.storage());
// Setup some preconditions. Create a cache with an entry.
GURL entry_url("http://blah/entry");
......@@ -404,7 +404,7 @@ TEST_F(MockAppCacheStorageTest, FindNoMainResponse) {
// Should complete asyncly.
MockAppCacheService service;
MockAppCacheStorage* storage =
reinterpret_cast<MockAppCacheStorage*>(service.storage());
static_cast<MockAppCacheStorage*>(service.storage());
// Conduct the test.
MockStorageDelegate delegate;
......@@ -429,7 +429,7 @@ TEST_F(MockAppCacheStorageTest, BasicFindMainResponse) {
// Should complete asyncly.
MockAppCacheService service;
MockAppCacheStorage* storage =
reinterpret_cast<MockAppCacheStorage*>(service.storage());
static_cast<MockAppCacheStorage*>(service.storage());
// Setup some preconditions. Create a complete cache with an entry.
const int64_t kCacheId = storage->NewCacheId();
......@@ -464,7 +464,7 @@ TEST_F(MockAppCacheStorageTest, BasicFindMainFallbackResponse) {
// Should complete asyncly.
MockAppCacheService service;
MockAppCacheStorage* storage =
reinterpret_cast<MockAppCacheStorage*>(service.storage());
static_cast<MockAppCacheStorage*>(service.storage());
// Setup some preconditions. Create a complete cache with a
// fallback namespace and entry.
......@@ -520,7 +520,7 @@ TEST_F(MockAppCacheStorageTest, FindMainResponseWithMultipleCandidates) {
// Should complete asyncly.
MockAppCacheService service;
MockAppCacheStorage* storage =
reinterpret_cast<MockAppCacheStorage*>(service.storage());
static_cast<MockAppCacheStorage*>(service.storage());
// Setup some preconditions. Create 2 complete caches with an entry
// for the same url.
......@@ -577,7 +577,7 @@ TEST_F(MockAppCacheStorageTest, FindMainResponseExclusions) {
// Should complete asyncly.
MockAppCacheService service;
MockAppCacheStorage* storage =
reinterpret_cast<MockAppCacheStorage*>(service.storage());
static_cast<MockAppCacheStorage*>(service.storage());
// Setup some preconditions. Create a complete cache with a
// foreign entry and an online namespace.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment