Commit 43d24066 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/sms
This CL was uploaded by git cl split.

R=reillyg@chromium.org

Change-Id: I2ec4c07a65a3452bc23982b31d5b0e8f08068838
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2435999
Auto-Submit: Kevin McNee <mcnee@chromium.org>
Reviewed-by: default avatarReilly Grant <reillyg@chromium.org>
Commit-Queue: Reilly Grant <reillyg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811321}
parent ab9b9d65
...@@ -318,7 +318,7 @@ TEST_F(SmsServiceTest, CleansUp) { ...@@ -318,7 +318,7 @@ TEST_F(SmsServiceTest, CleansUp) {
NiceMock<MockSmsWebContentsDelegate> delegate; NiceMock<MockSmsWebContentsDelegate> delegate;
WebContentsImpl* web_contents_impl = WebContentsImpl* web_contents_impl =
reinterpret_cast<WebContentsImpl*>(web_contents()); static_cast<WebContentsImpl*>(web_contents());
web_contents_impl->SetDelegate(&delegate); web_contents_impl->SetDelegate(&delegate);
NiceMock<MockSmsProvider> provider; NiceMock<MockSmsProvider> provider;
...@@ -404,7 +404,7 @@ TEST_F(SmsServiceTest, RecordMetricsForNewPage) { ...@@ -404,7 +404,7 @@ TEST_F(SmsServiceTest, RecordMetricsForNewPage) {
NavigateAndCommit(GURL(kTestUrl)); NavigateAndCommit(GURL(kTestUrl));
NiceMock<MockSmsWebContentsDelegate> delegate; NiceMock<MockSmsWebContentsDelegate> delegate;
WebContentsImpl* web_contents_impl = WebContentsImpl* web_contents_impl =
reinterpret_cast<WebContentsImpl*>(web_contents()); static_cast<WebContentsImpl*>(web_contents());
web_contents_impl->SetDelegate(&delegate); web_contents_impl->SetDelegate(&delegate);
NiceMock<MockSmsProvider> provider; NiceMock<MockSmsProvider> provider;
...@@ -442,7 +442,7 @@ TEST_F(SmsServiceTest, RecordMetricsForSamePage) { ...@@ -442,7 +442,7 @@ TEST_F(SmsServiceTest, RecordMetricsForSamePage) {
NavigateAndCommit(GURL(kTestUrl)); NavigateAndCommit(GURL(kTestUrl));
NiceMock<MockSmsWebContentsDelegate> delegate; NiceMock<MockSmsWebContentsDelegate> delegate;
WebContentsImpl* web_contents_impl = WebContentsImpl* web_contents_impl =
reinterpret_cast<WebContentsImpl*>(web_contents()); static_cast<WebContentsImpl*>(web_contents());
web_contents_impl->SetDelegate(&delegate); web_contents_impl->SetDelegate(&delegate);
NiceMock<MockSmsProvider> provider; NiceMock<MockSmsProvider> provider;
...@@ -762,7 +762,7 @@ TEST_F(SmsServiceTest, RecordMetricsForExistingPage) { ...@@ -762,7 +762,7 @@ TEST_F(SmsServiceTest, RecordMetricsForExistingPage) {
NiceMock<MockSmsWebContentsDelegate> delegate; NiceMock<MockSmsWebContentsDelegate> delegate;
WebContentsImpl* web_contents_impl = WebContentsImpl* web_contents_impl =
reinterpret_cast<WebContentsImpl*>(web_contents()); static_cast<WebContentsImpl*>(web_contents());
web_contents_impl->SetDelegate(&delegate); web_contents_impl->SetDelegate(&delegate);
NiceMock<MockSmsProvider> provider; NiceMock<MockSmsProvider> provider;
......
...@@ -34,7 +34,7 @@ class PromptBasedUserConsentHandlerTest : public RenderViewHostTestHarness { ...@@ -34,7 +34,7 @@ class PromptBasedUserConsentHandlerTest : public RenderViewHostTestHarness {
void SetUp() override { void SetUp() override {
RenderViewHostTestHarness::SetUp(); RenderViewHostTestHarness::SetUp();
WebContentsImpl* web_contents_impl = WebContentsImpl* web_contents_impl =
reinterpret_cast<WebContentsImpl*>(web_contents()); static_cast<WebContentsImpl*>(web_contents());
web_contents_impl->SetDelegate(&delegate_); web_contents_impl->SetDelegate(&delegate_);
} }
...@@ -136,7 +136,7 @@ TEST_F(PromptBasedUserConsentHandlerTest, CancelsWhenNoDelegate) { ...@@ -136,7 +136,7 @@ TEST_F(PromptBasedUserConsentHandlerTest, CancelsWhenNoDelegate) {
web_contents()->GetMainFrame()->GetLastCommittedOrigin(); web_contents()->GetMainFrame()->GetLastCommittedOrigin();
WebContentsImpl* web_contents_impl = WebContentsImpl* web_contents_impl =
reinterpret_cast<WebContentsImpl*>(web_contents()); static_cast<WebContentsImpl*>(web_contents());
web_contents_impl->SetDelegate(nullptr); web_contents_impl->SetDelegate(nullptr);
ExpectNoSmsPrompt(); ExpectNoSmsPrompt();
...@@ -150,4 +150,4 @@ TEST_F(PromptBasedUserConsentHandlerTest, CancelsWhenNoDelegate) { ...@@ -150,4 +150,4 @@ TEST_F(PromptBasedUserConsentHandlerTest, CancelsWhenNoDelegate) {
} }
} // namespace } // namespace
} // namespace content } // namespace content
\ No newline at end of file
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