Commit 808b3941 authored by Raphael Kubo da Costa's avatar Raphael Kubo da Costa Committed by Commit Bot

LocalFrameViewTest: Rename |ChromeClient()| to avoid naming conflicts

GCC is stricter than clang when it comes to class members' names and how
they can change the meaning of a previously existing symbol with the same
name:

    ../../third_party/WebKit/Source/core/frame/LocalFrameViewTest.cpp:72:77: error: declaration of ‘blink::{anonymous}::AnimationMockChromeClient& blink::{anonymous}::LocalFrameViewTest::ChromeClient() const’ [-fpermissive]
       AnimationMockChromeClient& ChromeClient() const { return *chrome_client_; }
                                                                                 ^
    In file included from ../../third_party/WebKit/Source/core/loader/EmptyClients.h:39:0,
                     from ../../third_party/WebKit/Source/core/layout/LayoutTestHelper.h:17,
                     from ../../third_party/WebKit/Source/core/frame/LocalFrameViewTest.cpp:10:
    ../../third_party/WebKit/Source/core/page/ChromeClient.h:94:19: error: changes meaning of ‘ChromeClient’ from ‘class blink::ChromeClient’ [-fpermissive]
     class CORE_EXPORT ChromeClient : public PlatformChromeClient {
                       ^~~~~~~~~~~~

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84709 contains a longer
explanation, but essentially having a |ChromeClient()| method can change the
meaning of references to |ChromeClient| in the code dependending on where it
is declared, which contradicts the C++ standard.

Fix it by renaming the method to |GetAnimationMockChromeClient()|.

Change-Id: I3d92e960384ba6b8d1885f7fed2618085ce19855
Reviewed-on: https://chromium-review.googlesource.com/968425Reviewed-by: default avatarDavid Bokan <bokan@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
Cr-Commit-Position: refs/heads/master@{#544031}
parent 1912996b
...@@ -54,12 +54,13 @@ class LocalFrameViewTest ...@@ -54,12 +54,13 @@ class LocalFrameViewTest
: ScopedRootLayerScrollingForTest(GetParam()), : ScopedRootLayerScrollingForTest(GetParam()),
RenderingTest(SingleChildLocalFrameClient::Create()), RenderingTest(SingleChildLocalFrameClient::Create()),
chrome_client_(new AnimationMockChromeClient) { chrome_client_(new AnimationMockChromeClient) {
EXPECT_CALL(ChromeClient(), AttachRootGraphicsLayer(_, _)) EXPECT_CALL(GetAnimationMockChromeClient(), AttachRootGraphicsLayer(_, _))
.Times(AnyNumber()); .Times(AnyNumber());
} }
~LocalFrameViewTest() { ~LocalFrameViewTest() {
::testing::Mock::VerifyAndClearExpectations(&ChromeClient()); ::testing::Mock::VerifyAndClearExpectations(
&GetAnimationMockChromeClient());
} }
ChromeClient& GetChromeClient() const override { return *chrome_client_; } ChromeClient& GetChromeClient() const override { return *chrome_client_; }
...@@ -69,7 +70,9 @@ class LocalFrameViewTest ...@@ -69,7 +70,9 @@ class LocalFrameViewTest
EnableCompositing(); EnableCompositing();
} }
AnimationMockChromeClient& ChromeClient() const { return *chrome_client_; } AnimationMockChromeClient& GetAnimationMockChromeClient() const {
return *chrome_client_;
}
private: private:
Persistent<AnimationMockChromeClient> chrome_client_; Persistent<AnimationMockChromeClient> chrome_client_;
...@@ -81,28 +84,28 @@ TEST_P(LocalFrameViewTest, SetPaintInvalidationDuringUpdateAllLifecyclePhases) { ...@@ -81,28 +84,28 @@ TEST_P(LocalFrameViewTest, SetPaintInvalidationDuringUpdateAllLifecyclePhases) {
SetBodyInnerHTML("<div id='a' style='color: blue'>A</div>"); SetBodyInnerHTML("<div id='a' style='color: blue'>A</div>");
GetDocument().getElementById("a")->setAttribute(HTMLNames::styleAttr, GetDocument().getElementById("a")->setAttribute(HTMLNames::styleAttr,
"color: green"); "color: green");
ChromeClient().has_scheduled_animation_ = false; GetAnimationMockChromeClient().has_scheduled_animation_ = false;
GetDocument().View()->UpdateAllLifecyclePhases(); GetDocument().View()->UpdateAllLifecyclePhases();
EXPECT_FALSE(ChromeClient().has_scheduled_animation_); EXPECT_FALSE(GetAnimationMockChromeClient().has_scheduled_animation_);
} }
TEST_P(LocalFrameViewTest, SetPaintInvalidationOutOfUpdateAllLifecyclePhases) { TEST_P(LocalFrameViewTest, SetPaintInvalidationOutOfUpdateAllLifecyclePhases) {
SetBodyInnerHTML("<div id='a' style='color: blue'>A</div>"); SetBodyInnerHTML("<div id='a' style='color: blue'>A</div>");
ChromeClient().has_scheduled_animation_ = false; GetAnimationMockChromeClient().has_scheduled_animation_ = false;
GetDocument() GetDocument()
.getElementById("a") .getElementById("a")
->GetLayoutObject() ->GetLayoutObject()
->SetShouldDoFullPaintInvalidation(); ->SetShouldDoFullPaintInvalidation();
EXPECT_TRUE(ChromeClient().has_scheduled_animation_); EXPECT_TRUE(GetAnimationMockChromeClient().has_scheduled_animation_);
ChromeClient().has_scheduled_animation_ = false; GetAnimationMockChromeClient().has_scheduled_animation_ = false;
GetDocument() GetDocument()
.getElementById("a") .getElementById("a")
->GetLayoutObject() ->GetLayoutObject()
->SetShouldDoFullPaintInvalidation(); ->SetShouldDoFullPaintInvalidation();
EXPECT_TRUE(ChromeClient().has_scheduled_animation_); EXPECT_TRUE(GetAnimationMockChromeClient().has_scheduled_animation_);
ChromeClient().has_scheduled_animation_ = false; GetAnimationMockChromeClient().has_scheduled_animation_ = false;
GetDocument().View()->UpdateAllLifecyclePhases(); GetDocument().View()->UpdateAllLifecyclePhases();
EXPECT_FALSE(ChromeClient().has_scheduled_animation_); EXPECT_FALSE(GetAnimationMockChromeClient().has_scheduled_animation_);
} }
// If we don't hide the tooltip on scroll, it can negatively impact scrolling // If we don't hide the tooltip on scroll, it can negatively impact scrolling
...@@ -110,14 +113,14 @@ TEST_P(LocalFrameViewTest, SetPaintInvalidationOutOfUpdateAllLifecyclePhases) { ...@@ -110,14 +113,14 @@ TEST_P(LocalFrameViewTest, SetPaintInvalidationOutOfUpdateAllLifecyclePhases) {
TEST_P(LocalFrameViewTest, HideTooltipWhenScrollPositionChanges) { TEST_P(LocalFrameViewTest, HideTooltipWhenScrollPositionChanges) {
SetBodyInnerHTML("<div style='width:1000px;height:1000px'></div>"); SetBodyInnerHTML("<div style='width:1000px;height:1000px'></div>");
EXPECT_CALL(ChromeClient(), EXPECT_CALL(GetAnimationMockChromeClient(),
MockSetToolTip(GetDocument().GetFrame(), String(), _)); MockSetToolTip(GetDocument().GetFrame(), String(), _));
GetDocument().View()->LayoutViewportScrollableArea()->SetScrollOffset( GetDocument().View()->LayoutViewportScrollableArea()->SetScrollOffset(
ScrollOffset(1, 1), kUserScroll); ScrollOffset(1, 1), kUserScroll);
// Programmatic scrolling should not dismiss the tooltip, so setToolTip // Programmatic scrolling should not dismiss the tooltip, so setToolTip
// should not be called for this invocation. // should not be called for this invocation.
EXPECT_CALL(ChromeClient(), EXPECT_CALL(GetAnimationMockChromeClient(),
MockSetToolTip(GetDocument().GetFrame(), String(), _)) MockSetToolTip(GetDocument().GetFrame(), String(), _))
.Times(0); .Times(0);
GetDocument().View()->LayoutViewportScrollableArea()->SetScrollOffset( GetDocument().View()->LayoutViewportScrollableArea()->SetScrollOffset(
......
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