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

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

Issue 1991273003: Fire visibilityChange event on out-of-process iframes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 4 years, 5 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 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 PlatformGestureEvent gestureEvent(PlatformEvent::EventType::GestureTap, hitP oint, hitPoint, IntSize(0, 0), 0, PlatformEvent::NoModifiers, PlatformGestureSou rceTouchscreen); 1592 PlatformGestureEvent gestureEvent(PlatformEvent::EventType::GestureTap, hitP oint, hitPoint, IntSize(0, 0), 0, PlatformEvent::NoModifiers, PlatformGestureSou rceTouchscreen);
1593 webViewHelper.webViewImpl()->mainFrameImpl()->frame()->eventHandler().handle GestureEvent(gestureEvent); 1593 webViewHelper.webViewImpl()->mainFrameImpl()->frame()->eventHandler().handle GestureEvent(gestureEvent);
1594 // when pressed, the button changes its own text to "updatedValue" 1594 // when pressed, the button changes its own text to "updatedValue"
1595 EXPECT_EQ(String("updatedValue"), element->innerText()); 1595 EXPECT_EQ(String("updatedValue"), element->innerText());
1596 } 1596 }
1597 1597
1598 TEST_F(WebFrameTest, FrameOwnerPropertiesMargin) 1598 TEST_F(WebFrameTest, FrameOwnerPropertiesMargin)
1599 { 1599 {
1600 FrameTestHelpers::TestWebViewClient viewClient; 1600 FrameTestHelpers::TestWebViewClient viewClient;
1601 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; 1601 FrameTestHelpers::TestWebRemoteFrameClient remoteClient;
1602 WebView* view = WebView::create(&viewClient); 1602 WebView* view = WebView::create(&viewClient, WebPageVisibilityStateVisible);
1603 view->settings()->setJavaScriptEnabled(true); 1603 view->settings()->setJavaScriptEnabled(true);
1604 view->setMainFrame(remoteClient.frame()); 1604 view->setMainFrame(remoteClient.frame());
1605 WebRemoteFrame* root = view->mainFrame()->toWebRemoteFrame(); 1605 WebRemoteFrame* root = view->mainFrame()->toWebRemoteFrame();
1606 root->setReplicatedOrigin(SecurityOrigin::createUnique()); 1606 root->setReplicatedOrigin(SecurityOrigin::createUnique());
1607 1607
1608 WebFrameOwnerProperties properties; 1608 WebFrameOwnerProperties properties;
1609 properties.marginWidth = 11; 1609 properties.marginWidth = 11;
1610 properties.marginHeight = 22; 1610 properties.marginHeight = 22;
1611 WebLocalFrame* localFrame = FrameTestHelpers::createLocalChild(root, "frameN ame", nullptr, nullptr, properties); 1611 WebLocalFrame* localFrame = FrameTestHelpers::createLocalChild(root, "frameN ame", nullptr, nullptr, properties);
1612 1612
(...skipping 11 matching lines...) Expand all
1624 EXPECT_NE(nullptr, frameView->horizontalScrollbar()); 1624 EXPECT_NE(nullptr, frameView->horizontalScrollbar());
1625 EXPECT_NE(nullptr, frameView->verticalScrollbar()); 1625 EXPECT_NE(nullptr, frameView->verticalScrollbar());
1626 1626
1627 view->close(); 1627 view->close();
1628 } 1628 }
1629 1629
1630 TEST_F(WebFrameTest, FrameOwnerPropertiesScrolling) 1630 TEST_F(WebFrameTest, FrameOwnerPropertiesScrolling)
1631 { 1631 {
1632 FrameTestHelpers::TestWebViewClient viewClient; 1632 FrameTestHelpers::TestWebViewClient viewClient;
1633 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; 1633 FrameTestHelpers::TestWebRemoteFrameClient remoteClient;
1634 WebView* view = WebView::create(&viewClient); 1634 WebView* view = WebView::create(&viewClient, WebPageVisibilityStateVisible);
1635 view->settings()->setJavaScriptEnabled(true); 1635 view->settings()->setJavaScriptEnabled(true);
1636 view->setMainFrame(remoteClient.frame()); 1636 view->setMainFrame(remoteClient.frame());
1637 WebRemoteFrame* root = view->mainFrame()->toWebRemoteFrame(); 1637 WebRemoteFrame* root = view->mainFrame()->toWebRemoteFrame();
1638 root->setReplicatedOrigin(SecurityOrigin::createUnique()); 1638 root->setReplicatedOrigin(SecurityOrigin::createUnique());
1639 1639
1640 WebFrameOwnerProperties properties; 1640 WebFrameOwnerProperties properties;
1641 // Turn off scrolling in the subframe. 1641 // Turn off scrolling in the subframe.
1642 properties.scrollingMode = WebFrameOwnerProperties::ScrollingMode::AlwaysOff ; 1642 properties.scrollingMode = WebFrameOwnerProperties::ScrollingMode::AlwaysOff ;
1643 WebLocalFrame* localFrame = FrameTestHelpers::createLocalChild(root, "frameN ame", nullptr, nullptr, properties); 1643 WebLocalFrame* localFrame = FrameTestHelpers::createLocalChild(root, "frameN ame", nullptr, nullptr, properties);
1644 1644
(...skipping 5444 matching lines...) Expand 10 before | Expand all | Expand 10 after
7089 } 7089 }
7090 7090
7091 // Make sure that an embedder-triggered detach with a remote frame parent 7091 // Make sure that an embedder-triggered detach with a remote frame parent
7092 // doesn't leave behind dangling pointers. 7092 // doesn't leave behind dangling pointers.
7093 TEST_P(ParameterizedWebFrameTest, EmbedderTriggeredDetachWithRemoteMainFrame) 7093 TEST_P(ParameterizedWebFrameTest, EmbedderTriggeredDetachWithRemoteMainFrame)
7094 { 7094 {
7095 // FIXME: Refactor some of this logic into WebViewHelper to make it easier t o 7095 // FIXME: Refactor some of this logic into WebViewHelper to make it easier t o
7096 // write tests with a top-level remote frame. 7096 // write tests with a top-level remote frame.
7097 FrameTestHelpers::TestWebViewClient viewClient; 7097 FrameTestHelpers::TestWebViewClient viewClient;
7098 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; 7098 FrameTestHelpers::TestWebRemoteFrameClient remoteClient;
7099 WebView* view = WebView::create(&viewClient); 7099 WebView* view = WebView::create(&viewClient, WebPageVisibilityStateVisible);
7100 view->setMainFrame(remoteClient.frame()); 7100 view->setMainFrame(remoteClient.frame());
7101 WebLocalFrame* childFrame = FrameTestHelpers::createLocalChild(view->mainFra me()->toWebRemoteFrame()); 7101 WebLocalFrame* childFrame = FrameTestHelpers::createLocalChild(view->mainFra me()->toWebRemoteFrame());
7102 7102
7103 // Purposely keep the LocalFrame alive so it's the last thing to be destroye d. 7103 // Purposely keep the LocalFrame alive so it's the last thing to be destroye d.
7104 Persistent<Frame> childCoreFrame = childFrame->toImplBase()->frame(); 7104 Persistent<Frame> childCoreFrame = childFrame->toImplBase()->frame();
7105 view->close(); 7105 view->close();
7106 childCoreFrame.clear(); 7106 childCoreFrame.clear();
7107 } 7107 }
7108 7108
7109 class WebFrameSwapTest : public WebFrameTest { 7109 class WebFrameSwapTest : public WebFrameTest {
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
7735 TEST_F(WebFrameTest, WindowOpenRemoteClose) 7735 TEST_F(WebFrameTest, WindowOpenRemoteClose)
7736 { 7736 {
7737 FrameTestHelpers::WebViewHelper mainWebView; 7737 FrameTestHelpers::WebViewHelper mainWebView;
7738 mainWebView.initialize(true); 7738 mainWebView.initialize(true);
7739 7739
7740 // Create a remote window that will be closed later in the test. 7740 // Create a remote window that will be closed later in the test.
7741 RemoteWindowCloseClient viewClient; 7741 RemoteWindowCloseClient viewClient;
7742 FrameTestHelpers::TestWebRemoteFrameClient frameClient; 7742 FrameTestHelpers::TestWebRemoteFrameClient frameClient;
7743 WebRemoteFrameImpl* webRemoteFrame = frameClient.frame(); 7743 WebRemoteFrameImpl* webRemoteFrame = frameClient.frame();
7744 7744
7745 WebView* view = WebView::create(&viewClient); 7745 WebView* view = WebView::create(&viewClient, WebPageVisibilityStateVisible);
7746 view->setMainFrame(webRemoteFrame); 7746 view->setMainFrame(webRemoteFrame);
7747 view->mainFrame()->setOpener(mainWebView.webView()->mainFrame()); 7747 view->mainFrame()->setOpener(mainWebView.webView()->mainFrame());
7748 webRemoteFrame->setReplicatedOrigin(WebSecurityOrigin::createFromString("htt p://127.0.0.1")); 7748 webRemoteFrame->setReplicatedOrigin(WebSecurityOrigin::createFromString("htt p://127.0.0.1"));
7749 7749
7750 LocalFrame* localFrame = toLocalFrame(mainWebView.webView()->mainFrame()->to ImplBase()->frame()); 7750 LocalFrame* localFrame = toLocalFrame(mainWebView.webView()->mainFrame()->to ImplBase()->frame());
7751 RemoteFrame* remoteFrame = webRemoteFrame->frame(); 7751 RemoteFrame* remoteFrame = webRemoteFrame->frame();
7752 7752
7753 // Attempt to close the window, which should fail as it isn't opened 7753 // Attempt to close the window, which should fail as it isn't opened
7754 // by a script. 7754 // by a script.
7755 remoteFrame->domWindow()->close(localFrame->document()); 7755 remoteFrame->domWindow()->close(localFrame->document());
7756 EXPECT_FALSE(viewClient.closed()); 7756 EXPECT_FALSE(viewClient.closed());
7757 7757
7758 // Marking it as opened by a script should now allow it to be closed. 7758 // Marking it as opened by a script should now allow it to be closed.
7759 remoteFrame->page()->setOpenedByDOM(); 7759 remoteFrame->page()->setOpenedByDOM();
7760 remoteFrame->domWindow()->close(localFrame->document()); 7760 remoteFrame->domWindow()->close(localFrame->document());
7761 EXPECT_TRUE(viewClient.closed()); 7761 EXPECT_TRUE(viewClient.closed());
7762 7762
7763 view->close(); 7763 view->close();
7764 } 7764 }
7765 7765
7766 TEST_F(WebFrameTest, NavigateRemoteToLocalWithOpener) 7766 TEST_F(WebFrameTest, NavigateRemoteToLocalWithOpener)
7767 { 7767 {
7768 FrameTestHelpers::WebViewHelper mainWebView; 7768 FrameTestHelpers::WebViewHelper mainWebView;
7769 mainWebView.initialize(true); 7769 mainWebView.initialize(true);
7770 WebFrame* mainFrame = mainWebView.webView()->mainFrame(); 7770 WebFrame* mainFrame = mainWebView.webView()->mainFrame();
7771 7771
7772 // Create a popup with a remote frame and set its opener to the main frame. 7772 // Create a popup with a remote frame and set its opener to the main frame.
7773 FrameTestHelpers::TestWebViewClient popupViewClient; 7773 FrameTestHelpers::TestWebViewClient popupViewClient;
7774 WebView* popupView = WebView::create(&popupViewClient); 7774 WebView* popupView = WebView::create(&popupViewClient, WebPageVisibilityStat eVisible);
7775 FrameTestHelpers::TestWebRemoteFrameClient popupRemoteClient; 7775 FrameTestHelpers::TestWebRemoteFrameClient popupRemoteClient;
7776 WebRemoteFrame* popupRemoteFrame = popupRemoteClient.frame(); 7776 WebRemoteFrame* popupRemoteFrame = popupRemoteClient.frame();
7777 popupView->setMainFrame(popupRemoteFrame); 7777 popupView->setMainFrame(popupRemoteFrame);
7778 popupRemoteFrame->setOpener(mainFrame); 7778 popupRemoteFrame->setOpener(mainFrame);
7779 popupRemoteFrame->setReplicatedOrigin(WebSecurityOrigin::createFromString("h ttp://foo.com")); 7779 popupRemoteFrame->setReplicatedOrigin(WebSecurityOrigin::createFromString("h ttp://foo.com"));
7780 EXPECT_FALSE(mainFrame->getSecurityOrigin().canAccess(popupView->mainFrame() ->getSecurityOrigin())); 7780 EXPECT_FALSE(mainFrame->getSecurityOrigin().canAccess(popupView->mainFrame() ->getSecurityOrigin()));
7781 7781
7782 // Do a remote-to-local swap in the popup. 7782 // Do a remote-to-local swap in the popup.
7783 FrameTestHelpers::TestWebFrameClient popupLocalClient; 7783 FrameTestHelpers::TestWebFrameClient popupLocalClient;
7784 WebLocalFrame* popupLocalFrame = WebLocalFrame::createProvisional(&popupLoca lClient, popupRemoteFrame, WebSandboxFlags::None); 7784 WebLocalFrame* popupLocalFrame = WebLocalFrame::createProvisional(&popupLoca lClient, popupRemoteFrame, WebSandboxFlags::None);
7785 popupRemoteFrame->swap(popupLocalFrame); 7785 popupRemoteFrame->swap(popupLocalFrame);
7786 7786
7787 // The initial document created during the remote-to-local swap should have 7787 // The initial document created during the remote-to-local swap should have
7788 // inherited its opener's SecurityOrigin. 7788 // inherited its opener's SecurityOrigin.
7789 EXPECT_TRUE(mainFrame->getSecurityOrigin().canAccess(popupView->mainFrame()- >getSecurityOrigin())); 7789 EXPECT_TRUE(mainFrame->getSecurityOrigin().canAccess(popupView->mainFrame()- >getSecurityOrigin()));
7790 7790
7791 popupView->close(); 7791 popupView->close();
7792 } 7792 }
7793 7793
7794 TEST_F(WebFrameTest, SwapWithOpenerCycle) 7794 TEST_F(WebFrameTest, SwapWithOpenerCycle)
7795 { 7795 {
7796 // First, create a remote main frame with itself as the opener. 7796 // First, create a remote main frame with itself as the opener.
7797 FrameTestHelpers::TestWebViewClient viewClient; 7797 FrameTestHelpers::TestWebViewClient viewClient;
7798 WebView* view = WebView::create(&viewClient); 7798 WebView* view = WebView::create(&viewClient, WebPageVisibilityStateVisible);
7799 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; 7799 FrameTestHelpers::TestWebRemoteFrameClient remoteClient;
7800 WebRemoteFrame* remoteFrame = remoteClient.frame(); 7800 WebRemoteFrame* remoteFrame = remoteClient.frame();
7801 view->setMainFrame(remoteFrame); 7801 view->setMainFrame(remoteFrame);
7802 remoteFrame->setOpener(remoteFrame); 7802 remoteFrame->setOpener(remoteFrame);
7803 7803
7804 // Now swap in a local frame. It shouldn't crash. 7804 // Now swap in a local frame. It shouldn't crash.
7805 FrameTestHelpers::TestWebFrameClient localClient; 7805 FrameTestHelpers::TestWebFrameClient localClient;
7806 WebLocalFrame* localFrame = WebLocalFrame::createProvisional(&localClient, r emoteFrame, WebSandboxFlags::None); 7806 WebLocalFrame* localFrame = WebLocalFrame::createProvisional(&localClient, r emoteFrame, WebSandboxFlags::None);
7807 remoteFrame->swap(localFrame); 7807 remoteFrame->swap(localFrame);
7808 7808
(...skipping 18 matching lines...) Expand all
7827 WebHistoryCommitType historyCommitType() const { return m_historyCommitType; } 7827 WebHistoryCommitType historyCommitType() const { return m_historyCommitType; }
7828 7828
7829 private: 7829 private:
7830 WebHistoryCommitType m_historyCommitType; 7830 WebHistoryCommitType m_historyCommitType;
7831 }; 7831 };
7832 7832
7833 TEST_P(ParameterizedWebFrameTest, RemoteFrameInitialCommitType) 7833 TEST_P(ParameterizedWebFrameTest, RemoteFrameInitialCommitType)
7834 { 7834 {
7835 FrameTestHelpers::TestWebViewClient viewClient; 7835 FrameTestHelpers::TestWebViewClient viewClient;
7836 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; 7836 FrameTestHelpers::TestWebRemoteFrameClient remoteClient;
7837 WebView* view = WebView::create(&viewClient); 7837 WebView* view = WebView::create(&viewClient, WebPageVisibilityStateVisible);
7838 view->setMainFrame(remoteClient.frame()); 7838 view->setMainFrame(remoteClient.frame());
7839 remoteClient.frame()->setReplicatedOrigin(WebSecurityOrigin::createFromStrin g(WebString::fromUTF8(m_baseURL))); 7839 remoteClient.frame()->setReplicatedOrigin(WebSecurityOrigin::createFromStrin g(WebString::fromUTF8(m_baseURL)));
7840 7840
7841 // If an iframe has a remote main frame, ensure the inital commit is correct ly identified as WebInitialCommitInChildFrame. 7841 // If an iframe has a remote main frame, ensure the inital commit is correct ly identified as WebInitialCommitInChildFrame.
7842 CommitTypeWebFrameClient childFrameClient; 7842 CommitTypeWebFrameClient childFrameClient;
7843 WebLocalFrame* childFrame = FrameTestHelpers::createLocalChild(view->mainFra me()->toWebRemoteFrame(), "frameName", &childFrameClient); 7843 WebLocalFrame* childFrame = FrameTestHelpers::createLocalChild(view->mainFra me()->toWebRemoteFrame(), "frameName", &childFrameClient);
7844 registerMockedHttpURLLoad("foo.html"); 7844 registerMockedHttpURLLoad("foo.html");
7845 FrameTestHelpers::loadFrame(childFrame, m_baseURL + "foo.html"); 7845 FrameTestHelpers::loadFrame(childFrame, m_baseURL + "foo.html");
7846 EXPECT_EQ(WebInitialCommitInChildFrame, childFrameClient.historyCommitType() ); 7846 EXPECT_EQ(WebInitialCommitInChildFrame, childFrameClient.historyCommitType() );
7847 view->close(); 7847 view->close();
7848 } 7848 }
7849 7849
7850 class GestureEventTestWebViewClient : public FrameTestHelpers::TestWebViewClient { 7850 class GestureEventTestWebViewClient : public FrameTestHelpers::TestWebViewClient {
7851 public: 7851 public:
7852 GestureEventTestWebViewClient() : m_didHandleGestureEvent(false) { } 7852 GestureEventTestWebViewClient() : m_didHandleGestureEvent(false) { }
7853 void didHandleGestureEvent(const WebGestureEvent& event, bool eventCancelled ) override { m_didHandleGestureEvent = true; } 7853 void didHandleGestureEvent(const WebGestureEvent& event, bool eventCancelled ) override { m_didHandleGestureEvent = true; }
7854 bool didHandleGestureEvent() const { return m_didHandleGestureEvent; } 7854 bool didHandleGestureEvent() const { return m_didHandleGestureEvent; }
7855 7855
7856 private: 7856 private:
7857 bool m_didHandleGestureEvent; 7857 bool m_didHandleGestureEvent;
7858 }; 7858 };
7859 7859
7860 TEST_P(ParameterizedWebFrameTest, FrameWidgetTest) 7860 TEST_P(ParameterizedWebFrameTest, FrameWidgetTest)
7861 { 7861 {
7862 FrameTestHelpers::TestWebViewClient viewClient; 7862 FrameTestHelpers::TestWebViewClient viewClient;
7863 WebView* view = WebView::create(&viewClient); 7863 WebView* view = WebView::create(&viewClient, WebPageVisibilityStateVisible);
7864 7864
7865 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; 7865 FrameTestHelpers::TestWebRemoteFrameClient remoteClient;
7866 view->setMainFrame(remoteClient.frame()); 7866 view->setMainFrame(remoteClient.frame());
7867 7867
7868 WebLocalFrame* childFrame = FrameTestHelpers::createLocalChild(view->mainFra me()->toWebRemoteFrame()); 7868 WebLocalFrame* childFrame = FrameTestHelpers::createLocalChild(view->mainFra me()->toWebRemoteFrame());
7869 7869
7870 GestureEventTestWebViewClient childViewClient; 7870 GestureEventTestWebViewClient childViewClient;
7871 WebFrameWidget* widget = WebFrameWidget::create(childViewClient.widgetClient (), childFrame); 7871 WebFrameWidget* widget = WebFrameWidget::create(childViewClient.widgetClient (), childFrame);
7872 7872
7873 view->resize(WebSize(1000, 1000)); 7873 view->resize(WebSize(1000, 1000));
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
7923 options.crossOriginRequestPolicy = AllowCrossOriginRequests; 7923 options.crossOriginRequestPolicy = AllowCrossOriginRequests;
7924 DocumentThreadableLoader::loadResourceSynchronously( 7924 DocumentThreadableLoader::loadResourceSynchronously(
7925 *frame->document(), request, client, options, resourceLoaderOptions); 7925 *frame->document(), request, client, options, resourceLoaderOptions);
7926 EXPECT_FALSE(client.failed()); 7926 EXPECT_FALSE(client.failed());
7927 } 7927 }
7928 7928
7929 TEST_P(ParameterizedWebFrameTest, DetachRemoteFrame) 7929 TEST_P(ParameterizedWebFrameTest, DetachRemoteFrame)
7930 { 7930 {
7931 FrameTestHelpers::TestWebViewClient viewClient; 7931 FrameTestHelpers::TestWebViewClient viewClient;
7932 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; 7932 FrameTestHelpers::TestWebRemoteFrameClient remoteClient;
7933 WebView* view = WebView::create(&viewClient); 7933 WebView* view = WebView::create(&viewClient, WebPageVisibilityStateVisible);
7934 view->setMainFrame(remoteClient.frame()); 7934 view->setMainFrame(remoteClient.frame());
7935 FrameTestHelpers::TestWebRemoteFrameClient childFrameClient; 7935 FrameTestHelpers::TestWebRemoteFrameClient childFrameClient;
7936 WebRemoteFrame* childFrame = FrameTestHelpers::createRemoteChild(view->mainF rame()->toWebRemoteFrame(), &childFrameClient); 7936 WebRemoteFrame* childFrame = FrameTestHelpers::createRemoteChild(view->mainF rame()->toWebRemoteFrame(), &childFrameClient);
7937 childFrame->detach(); 7937 childFrame->detach();
7938 view->close(); 7938 view->close();
7939 childFrame->close(); 7939 childFrame->close();
7940 } 7940 }
7941 7941
7942 class TestConsoleMessageWebFrameClient : public FrameTestHelpers::TestWebFrameCl ient { 7942 class TestConsoleMessageWebFrameClient : public FrameTestHelpers::TestWebFrameCl ient {
7943 public: 7943 public:
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
8048 params.screenPosition = WebDeviceEmulationParams::Mobile; 8048 params.screenPosition = WebDeviceEmulationParams::Mobile;
8049 m_webViewHelper.webView()->enableDeviceEmulation(params); 8049 m_webViewHelper.webView()->enableDeviceEmulation(params);
8050 EXPECT_EQ("20x20", dumpSize("pointer")); 8050 EXPECT_EQ("20x20", dumpSize("pointer"));
8051 m_webViewHelper.webView()->disableDeviceEmulation(); 8051 m_webViewHelper.webView()->disableDeviceEmulation();
8052 } 8052 }
8053 8053
8054 TEST_P(ParameterizedWebFrameTest, CreateLocalChildWithPreviousSibling) 8054 TEST_P(ParameterizedWebFrameTest, CreateLocalChildWithPreviousSibling)
8055 { 8055 {
8056 FrameTestHelpers::TestWebViewClient viewClient; 8056 FrameTestHelpers::TestWebViewClient viewClient;
8057 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; 8057 FrameTestHelpers::TestWebRemoteFrameClient remoteClient;
8058 WebView* view = WebView::create(&viewClient); 8058 WebView* view = WebView::create(&viewClient, WebPageVisibilityStateVisible);
8059 view->setMainFrame(remoteClient.frame()); 8059 view->setMainFrame(remoteClient.frame());
8060 WebRemoteFrame* parent = view->mainFrame()->toWebRemoteFrame(); 8060 WebRemoteFrame* parent = view->mainFrame()->toWebRemoteFrame();
8061 8061
8062 WebLocalFrame* secondFrame(FrameTestHelpers::createLocalChild(parent, "name2 ")); 8062 WebLocalFrame* secondFrame(FrameTestHelpers::createLocalChild(parent, "name2 "));
8063 WebLocalFrame* fourthFrame(FrameTestHelpers::createLocalChild(parent, "name4 ", nullptr, secondFrame)); 8063 WebLocalFrame* fourthFrame(FrameTestHelpers::createLocalChild(parent, "name4 ", nullptr, secondFrame));
8064 WebLocalFrame* thirdFrame(FrameTestHelpers::createLocalChild(parent, "name3" , nullptr, secondFrame)); 8064 WebLocalFrame* thirdFrame(FrameTestHelpers::createLocalChild(parent, "name3" , nullptr, secondFrame));
8065 WebLocalFrame* firstFrame(FrameTestHelpers::createLocalChild(parent, "name1" )); 8065 WebLocalFrame* firstFrame(FrameTestHelpers::createLocalChild(parent, "name1" ));
8066 8066
8067 EXPECT_EQ(firstFrame, parent->firstChild()); 8067 EXPECT_EQ(firstFrame, parent->firstChild());
8068 EXPECT_EQ(nullptr, firstFrame->previousSibling()); 8068 EXPECT_EQ(nullptr, firstFrame->previousSibling());
(...skipping 14 matching lines...) Expand all
8083 EXPECT_EQ(parent, thirdFrame->parent()); 8083 EXPECT_EQ(parent, thirdFrame->parent());
8084 EXPECT_EQ(parent, fourthFrame->parent()); 8084 EXPECT_EQ(parent, fourthFrame->parent());
8085 8085
8086 view->close(); 8086 view->close();
8087 } 8087 }
8088 8088
8089 TEST_P(ParameterizedWebFrameTest, SendBeaconFromChildWithRemoteMainFrame) 8089 TEST_P(ParameterizedWebFrameTest, SendBeaconFromChildWithRemoteMainFrame)
8090 { 8090 {
8091 FrameTestHelpers::TestWebViewClient viewClient; 8091 FrameTestHelpers::TestWebViewClient viewClient;
8092 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; 8092 FrameTestHelpers::TestWebRemoteFrameClient remoteClient;
8093 WebView* view = WebView::create(&viewClient); 8093 WebView* view = WebView::create(&viewClient, WebPageVisibilityStateVisible);
8094 view->settings()->setJavaScriptEnabled(true); 8094 view->settings()->setJavaScriptEnabled(true);
8095 view->setMainFrame(remoteClient.frame()); 8095 view->setMainFrame(remoteClient.frame());
8096 WebRemoteFrame* root = view->mainFrame()->toWebRemoteFrame(); 8096 WebRemoteFrame* root = view->mainFrame()->toWebRemoteFrame();
8097 root->setReplicatedOrigin(SecurityOrigin::createUnique()); 8097 root->setReplicatedOrigin(SecurityOrigin::createUnique());
8098 8098
8099 WebLocalFrame* localFrame = FrameTestHelpers::createLocalChild(root); 8099 WebLocalFrame* localFrame = FrameTestHelpers::createLocalChild(root);
8100 8100
8101 // Finally, make sure an embedder triggered load in the local frame swapped 8101 // Finally, make sure an embedder triggered load in the local frame swapped
8102 // back in works. 8102 // back in works.
8103 registerMockedHttpURLLoad("send_beacon.html"); 8103 registerMockedHttpURLLoad("send_beacon.html");
8104 registerMockedHttpURLLoad("reload_post.html"); // url param to sendBeacon() 8104 registerMockedHttpURLLoad("reload_post.html"); // url param to sendBeacon()
8105 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "send_beacon.html"); 8105 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "send_beacon.html");
8106 8106
8107 view->close(); 8107 view->close();
8108 } 8108 }
8109 8109
8110 TEST_P(ParameterizedWebFrameTest, FirstPartyForCookiesFromChildWithRemoteMainFra me) 8110 TEST_P(ParameterizedWebFrameTest, FirstPartyForCookiesFromChildWithRemoteMainFra me)
8111 { 8111 {
8112 FrameTestHelpers::TestWebViewClient viewClient; 8112 FrameTestHelpers::TestWebViewClient viewClient;
8113 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; 8113 FrameTestHelpers::TestWebRemoteFrameClient remoteClient;
8114 WebView* view = WebView::create(&viewClient); 8114 WebView* view = WebView::create(&viewClient, WebPageVisibilityStateVisible);
8115 view->setMainFrame(remoteClient.frame()); 8115 view->setMainFrame(remoteClient.frame());
8116 WebRemoteFrame* root = view->mainFrame()->toWebRemoteFrame(); 8116 WebRemoteFrame* root = view->mainFrame()->toWebRemoteFrame();
8117 root->setReplicatedOrigin(SecurityOrigin::create(toKURL(m_notBaseURL))); 8117 root->setReplicatedOrigin(SecurityOrigin::create(toKURL(m_notBaseURL)));
8118 8118
8119 WebLocalFrame* localFrame = FrameTestHelpers::createLocalChild(root); 8119 WebLocalFrame* localFrame = FrameTestHelpers::createLocalChild(root);
8120 8120
8121 registerMockedHttpURLLoad("foo.html"); 8121 registerMockedHttpURLLoad("foo.html");
8122 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "foo.html"); 8122 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "foo.html");
8123 EXPECT_EQ(WebURL(SecurityOrigin::urlWithUniqueSecurityOrigin()), localFrame- >document().firstPartyForCookies()); 8123 EXPECT_EQ(WebURL(SecurityOrigin::urlWithUniqueSecurityOrigin()), localFrame- >document().firstPartyForCookies());
8124 8124
8125 SchemeRegistry::registerURLSchemeAsFirstPartyWhenTopLevel("http"); 8125 SchemeRegistry::registerURLSchemeAsFirstPartyWhenTopLevel("http");
8126 EXPECT_EQ(WebURL(toKURL(m_notBaseURL)), localFrame->document().firstPartyFor Cookies()); 8126 EXPECT_EQ(WebURL(toKURL(m_notBaseURL)), localFrame->document().firstPartyFor Cookies());
8127 SchemeRegistry::removeURLSchemeAsFirstPartyWhenTopLevel("http"); 8127 SchemeRegistry::removeURLSchemeAsFirstPartyWhenTopLevel("http");
8128 8128
8129 view->close(); 8129 view->close();
8130 } 8130 }
8131 8131
8132 // See https://crbug.com/525285. 8132 // See https://crbug.com/525285.
8133 TEST_P(ParameterizedWebFrameTest, RemoteToLocalSwapOnMainFrameInitializesCoreFra me) 8133 TEST_P(ParameterizedWebFrameTest, RemoteToLocalSwapOnMainFrameInitializesCoreFra me)
8134 { 8134 {
8135 FrameTestHelpers::TestWebViewClient viewClient; 8135 FrameTestHelpers::TestWebViewClient viewClient;
8136 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; 8136 FrameTestHelpers::TestWebRemoteFrameClient remoteClient;
8137 WebView* view = WebView::create(&viewClient); 8137 WebView* view = WebView::create(&viewClient, WebPageVisibilityStateVisible);
8138 view->setMainFrame(remoteClient.frame()); 8138 view->setMainFrame(remoteClient.frame());
8139 WebRemoteFrame* remoteRoot = view->mainFrame()->toWebRemoteFrame(); 8139 WebRemoteFrame* remoteRoot = view->mainFrame()->toWebRemoteFrame();
8140 remoteRoot->setReplicatedOrigin(SecurityOrigin::createUnique()); 8140 remoteRoot->setReplicatedOrigin(SecurityOrigin::createUnique());
8141 8141
8142 FrameTestHelpers::createLocalChild(remoteRoot); 8142 FrameTestHelpers::createLocalChild(remoteRoot);
8143 8143
8144 // Do a remote-to-local swap of the top frame. 8144 // Do a remote-to-local swap of the top frame.
8145 FrameTestHelpers::TestWebFrameClient localClient; 8145 FrameTestHelpers::TestWebFrameClient localClient;
8146 WebLocalFrame* localRoot = WebLocalFrame::createProvisional(&localClient, re moteRoot, WebSandboxFlags::None); 8146 WebLocalFrame* localRoot = WebLocalFrame::createProvisional(&localClient, re moteRoot, WebSandboxFlags::None);
8147 remoteRoot->swap(localRoot); 8147 remoteRoot->swap(localRoot);
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
8812 request.setURL(toKURL("javascript:location='" + redirectURL + "'")); 8812 request.setURL(toKURL("javascript:location='" + redirectURL + "'"));
8813 helper.webViewImpl()->mainFrame()->toWebLocalFrame()->loadRequest(request); 8813 helper.webViewImpl()->mainFrame()->toWebLocalFrame()->loadRequest(request);
8814 8814
8815 // Normally, the result of the JS url replaces the existing contents on the 8815 // Normally, the result of the JS url replaces the existing contents on the
8816 // Document. However, if the JS triggers a navigation, the contents should 8816 // Document. However, if the JS triggers a navigation, the contents should
8817 // not be replaced. 8817 // not be replaced.
8818 EXPECT_EQ("", toLocalFrame(helper.webViewImpl()->page()->mainFrame())->docum ent()->documentElement()->innerText()); 8818 EXPECT_EQ("", toLocalFrame(helper.webViewImpl()->page()->mainFrame())->docum ent()->documentElement()->innerText());
8819 } 8819 }
8820 8820
8821 } // namespace blink 8821 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp ('k') | third_party/WebKit/Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698