Chromium Code Reviews| Index: third_party/WebKit/Source/web/tests/WebFrameTest.cpp |
| diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp |
| index 7107a03c2d27bf6137150707c06e2a31b8abbed2..cf2c0438b3e056c370b7fcbdd935681736e8ff5a 100644 |
| --- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp |
| +++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp |
| @@ -32,8 +32,10 @@ |
| #include <stdarg.h> |
| +#include <limits> |
| #include <map> |
| #include <memory> |
| +#include <set> |
| #include "SkBitmap.h" |
| #include "SkCanvas.h" |
| @@ -621,7 +623,7 @@ TEST_P(ParameterizedWebFrameTest, FormWithNullFrame) { |
| web_view_helper.InitializeAndLoad(base_url_ + "form.html"); |
| WebVector<WebFormElement> forms; |
| - web_view_helper.WebView()->MainFrame()->GetDocument().Forms(forms); |
| + web_view_helper.WebView()->MainFrameImpl()->GetDocument().Forms(forms); |
| web_view_helper.Reset(); |
| EXPECT_EQ(forms.size(), 1U); |
| @@ -1009,7 +1011,8 @@ TEST_P(ParameterizedWebFrameTest, DispatchMessageEventWithOriginCheck) { |
| // Send a message with the correct origin. |
| WebSecurityOrigin correct_origin( |
| WebSecurityOrigin::Create(ToKURL(base_url_))); |
| - WebDocument document = web_view_helper.WebView()->MainFrame()->GetDocument(); |
| + WebDocument document = |
| + web_view_helper.WebView()->MainFrameImpl()->GetDocument(); |
| WebSerializedScriptValue data(WebSerializedScriptValue::CreateInvalid()); |
| WebDOMMessageEvent message(data, "http://origin.com"); |
| web_view_helper.WebView() |
| @@ -3927,7 +3930,7 @@ TEST_F(WebFrameTest, DivScrollIntoEditableTest) { |
| web_view_helper.WebView()->AdvanceFocus(false); |
| // Set the caret to the end of the input box. |
| web_view_helper.WebView() |
| - ->MainFrame() |
| + ->MainFrameImpl() |
| ->GetDocument() |
| .GetElementById("EditBoxWithText") |
| .To<WebInputElement>() |
| @@ -4024,7 +4027,7 @@ TEST_F(WebFrameTest, DivScrollIntoEditablePreservePageScaleTest) { |
| web_view_helper.WebView()->AdvanceFocus(false); |
| // Set the caret to the begining of the input box. |
| web_view_helper.WebView() |
| - ->MainFrame() |
| + ->MainFrameImpl() |
| ->GetDocument() |
| .GetElementById("EditBoxWithText") |
| .To<WebInputElement>() |
| @@ -5327,7 +5330,7 @@ static WebPoint BottomRightMinusOne(const WebRect& rect) { |
| return WebPoint(rect.x + rect.width - 1, rect.y + rect.height - 1); |
| } |
| -static WebRect ElementBounds(WebFrame* frame, const WebString& id) { |
| +static WebRect ElementBounds(WebLocalFrame* frame, const WebString& id) { |
| return frame->GetDocument().GetElementById(id).BoundsInViewport(); |
| } |
| @@ -6704,9 +6707,8 @@ class StubbornTextCheckClient : public WebTextCheckClient { |
| StubbornTextCheckClient() : completion_(0) {} |
| virtual ~StubbornTextCheckClient() {} |
| - virtual void RequestCheckingOfText( |
| - const WebString&, |
| - WebTextCheckingCompletion* completion) override { |
| + void RequestCheckingOfText(const WebString&, |
| + WebTextCheckingCompletion* completion) override { |
| completion_ = completion; |
| } |
| @@ -7175,7 +7177,7 @@ TEST_P(ParameterizedWebFrameTest, FirstPartyForCookiesForRedirect) { |
| FrameTestHelpers::WebViewHelper web_view_helper; |
| web_view_helper.InitializeAndLoad(base_url_ + "first_party_redirect.html"); |
| EXPECT_TRUE(web_view_helper.WebView() |
| - ->MainFrame() |
| + ->MainFrameImpl() |
| ->GetDocument() |
| .FirstPartyForCookies() == redirect_url); |
| } |
| @@ -7218,12 +7220,12 @@ TEST_P(ParameterizedWebFrameTest, SimulateFragmentAnchorMiddleClick) { |
| class TestNewWindowWebViewClient : public FrameTestHelpers::TestWebViewClient { |
| public: |
| - virtual WebView* CreateView(WebLocalFrame*, |
| - const WebURLRequest&, |
| - const WebWindowFeatures&, |
| - const WebString&, |
| - WebNavigationPolicy, |
| - bool) override { |
| + WebView* CreateView(WebLocalFrame*, |
| + const WebURLRequest&, |
| + const WebWindowFeatures&, |
| + const WebString&, |
| + WebNavigationPolicy, |
| + bool) override { |
| EXPECT_TRUE(false); |
| return 0; |
| } |
| @@ -7702,8 +7704,8 @@ TEST_P(ParameterizedWebFrameTest, FirstBlankSubframeNavigation) { |
| frame->ExecuteScript(WebScriptSource(WebString::FromUTF8( |
| "document.body.appendChild(document.createElement('iframe'))"))); |
| - WebFrame* iframe = frame->FirstChild(); |
| - ASSERT_EQ(&client.ChildClient(), ToWebLocalFrameBase(iframe)->Client()); |
| + WebLocalFrameBase* iframe = ToWebLocalFrameBase(frame->FirstChild()); |
| + ASSERT_EQ(&client.ChildClient(), iframe->Client()); |
| std::string url1 = base_url_ + "history.html"; |
| FrameTestHelpers::LoadFrame(iframe, url1); |
| @@ -7726,7 +7728,7 @@ TEST_P(ParameterizedWebFrameTest, FirstNonBlankSubframeNavigation) { |
| FrameTestHelpers::WebViewHelper web_view_helper; |
| web_view_helper.InitializeAndLoad("about:blank", &client); |
| - WebFrame* frame = web_view_helper.WebView()->MainFrame(); |
| + WebLocalFrame* frame = web_view_helper.WebView()->MainFrameImpl(); |
|
dcheng
2017/06/20 09:02:21
Nit: this can just be web_view_helper.LocalMainFra
dcheng
2017/06/20 09:03:13
(Of course this only applies when there's an acces
Łukasz Anforowicz
2017/06/20 16:59:44
This cleanup opportunity impacts more lines than t
|
| std::string url1 = base_url_ + "history.html"; |
| FrameTestHelpers::LoadFrame( |
| @@ -7737,7 +7739,7 @@ TEST_P(ParameterizedWebFrameTest, FirstNonBlankSubframeNavigation) { |
| "';" |
| "document.body.appendChild(f)"); |
| - WebFrame* iframe = frame->FirstChild(); |
| + WebLocalFrame* iframe = frame->FirstChild()->ToWebLocalFrame(); |
| EXPECT_EQ(url1, iframe->GetDocument().Url().GetString().Utf8()); |
| std::string url2 = base_url_ + "find.html"; |
| @@ -9597,8 +9599,7 @@ TEST_F(WebFrameTest, SwapWithOpenerCycle) { |
| class CommitTypeWebFrameClient : public FrameTestHelpers::TestWebFrameClient { |
| public: |
| - explicit CommitTypeWebFrameClient() |
| - : history_commit_type_(kWebHistoryInertCommit) {} |
| + CommitTypeWebFrameClient() : history_commit_type_(kWebHistoryInertCommit) {} |
| void DidCommitProvisionalLoad( |
| const WebHistoryItem&, |
| @@ -10705,7 +10706,7 @@ TEST_F(WebFrameTest, CopyImageAt) { |
| ->ReadRawImage(WebClipboard::Buffer()); |
| EXPECT_EQ(SkColorSetARGB(255, 255, 0, 0), image.GetSkBitmap().getColor(0, 0)); |
| -}; |
| +} |
| TEST_F(WebFrameTest, CopyImageAtWithPinchZoom) { |
| std::string url = base_url_ + "canvas-copy-image.html"; |
| @@ -10732,7 +10733,7 @@ TEST_F(WebFrameTest, CopyImageAtWithPinchZoom) { |
| ->ReadRawImage(WebClipboard::Buffer()); |
| EXPECT_EQ(SkColorSetARGB(255, 255, 0, 0), image.GetSkBitmap().getColor(0, 0)); |
| -}; |
| +} |
| TEST_F(WebFrameTest, CopyImageWithImageMap) { |
| SaveImageFromDataURLWebFrameClient client; |
| @@ -12039,7 +12040,7 @@ TEST_F(WebFrameTest, ShowVirtualKeyboardOnElementFocus) { |
| class ContextMenuWebFrameClient : public FrameTestHelpers::TestWebFrameClient { |
| public: |
| - ContextMenuWebFrameClient(){}; |
| + ContextMenuWebFrameClient() {} |
| // WebFrameClient methods |
| void ShowContextMenu(const WebContextMenuData& data) override { |
| menu_data_ = data; |
| @@ -12136,7 +12137,7 @@ TEST_F(WebFrameTest, LocalFrameWithRemoteParentIsTransparent) { |
| class TestFallbackWebFrameClient : public FrameTestHelpers::TestWebFrameClient { |
| public: |
| - explicit TestFallbackWebFrameClient() : child_client_(nullptr) {} |
| + TestFallbackWebFrameClient() : child_client_(nullptr) {} |
| void SetChildWebFrameClient(TestFallbackWebFrameClient* client) { |
| child_client_ = client; |