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

Side by Side Diff: third_party/WebKit/Source/web/tests/WebFrameTest.cpp

Issue 1568383002: Preserve page resize information when main frame is remote (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dcheng's suggestion Created 4 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 7003 matching lines...) Expand 10 before | Expand all | Expand 10 after
7014 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "subframe-hello.html"); 7014 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "subframe-hello.html");
7015 std::string content = localFrame->contentAsText(1024).utf8(); 7015 std::string content = localFrame->contentAsText(1024).utf8();
7016 EXPECT_EQ("hello", content); 7016 EXPECT_EQ("hello", content);
7017 7017
7018 // Manually reset to break WebViewHelper's dependency on the stack allocated 7018 // Manually reset to break WebViewHelper's dependency on the stack allocated
7019 // TestWebFrameClient. 7019 // TestWebFrameClient.
7020 reset(); 7020 reset();
7021 remoteFrame->close(); 7021 remoteFrame->close();
7022 } 7022 }
7023 7023
7024 TEST_F(WebFrameSwapTest, ValidateSizeOnRemoteToLocalMainFrameSwap)
7025 {
7026 WebSize size(111, 222);
7027
7028 WebRemoteFrame* remoteFrame = WebRemoteFrame::create(WebTreeScopeType::Docum ent, nullptr);
7029 mainFrame()->swap(remoteFrame);
7030
7031 remoteFrame->view()->resize(size);
7032
7033 FrameTestHelpers::TestWebFrameClient client;
7034 WebLocalFrame* localFrame = WebLocalFrame::createProvisional(&client, remote Frame, WebSandboxFlags::None, WebFrameOwnerProperties());
7035 remoteFrame->swap(localFrame);
7036
7037 // Verify that the size that was set with a remote main frame is correct
7038 // after swapping to a local frame.
7039 WebFloatSize floatSize = localFrame->view()->visualViewportSize();
bokan 2016/01/11 18:18:58 This actually returns the scaled size of the viewp
kenrb 2016/01/11 20:50:26 Done.
7040 EXPECT_EQ(size.width, floatSize.width);
7041 EXPECT_EQ(size.height, floatSize.height);
7042
7043 // Manually reset to break WebViewHelper's dependency on the stack allocated
7044 // TestWebFrameClient.
7045 reset();
7046 remoteFrame->close();
7047 }
7048
7024 namespace { 7049 namespace {
7025 7050
7026 class SwapMainFrameWhenTitleChangesWebFrameClient : public FrameTestHelpers::Tes tWebFrameClient { 7051 class SwapMainFrameWhenTitleChangesWebFrameClient : public FrameTestHelpers::Tes tWebFrameClient {
7027 public: 7052 public:
7028 SwapMainFrameWhenTitleChangesWebFrameClient() 7053 SwapMainFrameWhenTitleChangesWebFrameClient()
7029 : m_remoteFrame(nullptr) 7054 : m_remoteFrame(nullptr)
7030 { 7055 {
7031 } 7056 }
7032 7057
7033 ~SwapMainFrameWhenTitleChangesWebFrameClient() override 7058 ~SwapMainFrameWhenTitleChangesWebFrameClient() override
(...skipping 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after
8351 8376
8352 TEST_F(WebFrameTest, CallbackOrdering) 8377 TEST_F(WebFrameTest, CallbackOrdering)
8353 { 8378 {
8354 registerMockedHttpURLLoad("foo.html"); 8379 registerMockedHttpURLLoad("foo.html");
8355 FrameTestHelpers::WebViewHelper webViewHelper; 8380 FrameTestHelpers::WebViewHelper webViewHelper;
8356 CallbackOrderingWebFrameClient client; 8381 CallbackOrderingWebFrameClient client;
8357 webViewHelper.initializeAndLoad(m_baseURL + "foo.html", true, &client); 8382 webViewHelper.initializeAndLoad(m_baseURL + "foo.html", true, &client);
8358 } 8383 }
8359 8384
8360 } // namespace blink 8385 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698