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

Side by Side Diff: Source/web/tests/WebViewTest.cpp

Issue 838903002: Replicate sandbox flags for OOPIF (Blink part 2) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@iframe-sandbox-flags-part1
Patch Set: Simplify the plumbing by making HTMLFrameOwnerElement::sandboxFlags() public Created 5 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) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 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 1669 matching lines...) Expand 10 before | Expand all | Expand 10 after
1680 webView->layout(); 1680 webView->layout();
1681 WebRect cropRect(0, 0, 100, 100); 1681 WebRect cropRect(0, 0, 100, 100);
1682 webView->extractSmartClipData(cropRect, clipText, clipHtml, clipRect); 1682 webView->extractSmartClipData(cropRect, clipText, clipHtml, clipRect);
1683 EXPECT_STREQ("", clipText.utf8().c_str()); 1683 EXPECT_STREQ("", clipText.utf8().c_str());
1684 EXPECT_STREQ("", clipHtml.utf8().c_str()); 1684 EXPECT_STREQ("", clipHtml.utf8().c_str());
1685 } 1685 }
1686 1686
1687 class CreateChildCounterFrameClient : public FrameTestHelpers::TestWebFrameClien t { 1687 class CreateChildCounterFrameClient : public FrameTestHelpers::TestWebFrameClien t {
1688 public: 1688 public:
1689 CreateChildCounterFrameClient() : m_count(0) { } 1689 CreateChildCounterFrameClient() : m_count(0) { }
1690 virtual WebFrame* createChildFrame(WebLocalFrame* parent, const WebString& f rameName) override; 1690 virtual WebFrame* createChildFrame(WebLocalFrame* parent, const WebString& f rameName, WebSandboxFlags) override;
1691 1691
1692 int count() const { return m_count; } 1692 int count() const { return m_count; }
1693 1693
1694 private: 1694 private:
1695 int m_count; 1695 int m_count;
1696 }; 1696 };
1697 1697
1698 WebFrame* CreateChildCounterFrameClient::createChildFrame(WebLocalFrame* parent, const WebString& frameName) 1698 WebFrame* CreateChildCounterFrameClient::createChildFrame(WebLocalFrame* parent, const WebString& frameName, WebSandboxFlags sandboxFlags)
1699 { 1699 {
1700 ++m_count; 1700 ++m_count;
1701 return TestWebFrameClient::createChildFrame(parent, frameName); 1701 return TestWebFrameClient::createChildFrame(parent, frameName, sandboxFlags) ;
1702 } 1702 }
1703 1703
1704 TEST_F(WebViewTest, AddFrameInCloseUnload) 1704 TEST_F(WebViewTest, AddFrameInCloseUnload)
1705 { 1705 {
1706 CreateChildCounterFrameClient frameClient; 1706 CreateChildCounterFrameClient frameClient;
1707 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("add_frame_in_unload.html")); 1707 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("add_frame_in_unload.html"));
1708 m_webViewHelper.initializeAndLoad(m_baseURL + "add_frame_in_unload.html", tr ue, &frameClient); 1708 m_webViewHelper.initializeAndLoad(m_baseURL + "add_frame_in_unload.html", tr ue, &frameClient);
1709 m_webViewHelper.reset(); 1709 m_webViewHelper.reset();
1710 EXPECT_EQ(0, frameClient.count()); 1710 EXPECT_EQ(0, frameClient.count());
1711 } 1711 }
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
2315 // Test without any preventDefault. 2315 // Test without any preventDefault.
2316 client.reset(); 2316 client.reset();
2317 frame->executeScript(WebScriptSource("setTest('none');")); 2317 frame->executeScript(WebScriptSource("setTest('none');"));
2318 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, WebString::fr omUTF8("target"))); 2318 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, WebString::fr omUTF8("target")));
2319 EXPECT_TRUE(client.getWasCalled()); 2319 EXPECT_TRUE(client.getWasCalled());
2320 2320
2321 m_webViewHelper.reset(); // Remove dependency on locally scoped client. 2321 m_webViewHelper.reset(); // Remove dependency on locally scoped client.
2322 } 2322 }
2323 2323
2324 } // namespace 2324 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698