| OLD | NEW |
| 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 207 |
| 208 TEST_F(WebFrameTest, FrameForEnteredContext) | 208 TEST_F(WebFrameTest, FrameForEnteredContext) |
| 209 { | 209 { |
| 210 registerMockedHttpURLLoad("iframes_test.html"); | 210 registerMockedHttpURLLoad("iframes_test.html"); |
| 211 registerMockedHttpURLLoad("visible_iframe.html"); | 211 registerMockedHttpURLLoad("visible_iframe.html"); |
| 212 registerMockedHttpURLLoad("invisible_iframe.html"); | 212 registerMockedHttpURLLoad("invisible_iframe.html"); |
| 213 registerMockedHttpURLLoad("zero_sized_iframe.html"); | 213 registerMockedHttpURLLoad("zero_sized_iframe.html"); |
| 214 | 214 |
| 215 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframes_test
.html", true); | 215 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframes_test
.html", true); |
| 216 | 216 |
| 217 v8::HandleScope scope; | 217 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
| 218 EXPECT_EQ(m_webView->mainFrame(), | 218 EXPECT_EQ(m_webView->mainFrame(), |
| 219 WebFrame::frameForContext( | 219 WebFrame::frameForContext( |
| 220 m_webView->mainFrame()->mainWorldScriptContext())); | 220 m_webView->mainFrame()->mainWorldScriptContext())); |
| 221 EXPECT_EQ(m_webView->mainFrame()->firstChild(), | 221 EXPECT_EQ(m_webView->mainFrame()->firstChild(), |
| 222 WebFrame::frameForContext( | 222 WebFrame::frameForContext( |
| 223 m_webView->mainFrame()->firstChild()->mainWorldScriptContext()
)); | 223 m_webView->mainFrame()->firstChild()->mainWorldScriptContext()
)); |
| 224 } | 224 } |
| 225 | 225 |
| 226 TEST_F(WebFrameTest, FormWithNullFrame) | 226 TEST_F(WebFrameTest, FormWithNullFrame) |
| 227 { | 227 { |
| (...skipping 1543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1771 | 1771 |
| 1772 virtual void willReleaseScriptContext(WebFrame* frame, v8::Handle<v8::Contex
t> context, int worldId) OVERRIDE | 1772 virtual void willReleaseScriptContext(WebFrame* frame, v8::Handle<v8::Contex
t> context, int worldId) OVERRIDE |
| 1773 { | 1773 { |
| 1774 releaseNotifications.push_back(new Notification(frame, context, worldId)
); | 1774 releaseNotifications.push_back(new Notification(frame, context, worldId)
); |
| 1775 } | 1775 } |
| 1776 }; | 1776 }; |
| 1777 | 1777 |
| 1778 // TODO(aa): Deflake this test. | 1778 // TODO(aa): Deflake this test. |
| 1779 TEST_F(WebFrameTest, FLAKY_ContextNotificationsLoadUnload) | 1779 TEST_F(WebFrameTest, FLAKY_ContextNotificationsLoadUnload) |
| 1780 { | 1780 { |
| 1781 v8::HandleScope handleScope; | 1781 v8::HandleScope handleScope(v8::Isolate::GetCurrent()); |
| 1782 | 1782 |
| 1783 registerMockedHttpURLLoad("context_notifications_test.html"); | 1783 registerMockedHttpURLLoad("context_notifications_test.html"); |
| 1784 registerMockedHttpURLLoad("context_notifications_test_frame.html"); | 1784 registerMockedHttpURLLoad("context_notifications_test_frame.html"); |
| 1785 | 1785 |
| 1786 // Load a frame with an iframe, make sure we get the right create notificati
ons. | 1786 // Load a frame with an iframe, make sure we get the right create notificati
ons. |
| 1787 ContextLifetimeTestWebFrameClient webFrameClient; | 1787 ContextLifetimeTestWebFrameClient webFrameClient; |
| 1788 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "context_noti
fications_test.html", true, &webFrameClient); | 1788 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "context_noti
fications_test.html", true, &webFrameClient); |
| 1789 | 1789 |
| 1790 WebFrame* mainFrame = m_webView->mainFrame(); | 1790 WebFrame* mainFrame = m_webView->mainFrame(); |
| 1791 WebFrame* childFrame = mainFrame->firstChild(); | 1791 WebFrame* childFrame = mainFrame->firstChild(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1811 ASSERT_EQ(2u, webFrameClient.releaseNotifications.size()); | 1811 ASSERT_EQ(2u, webFrameClient.releaseNotifications.size()); |
| 1812 ContextLifetimeTestWebFrameClient::Notification* firstReleaseNotification =
webFrameClient.releaseNotifications[0]; | 1812 ContextLifetimeTestWebFrameClient::Notification* firstReleaseNotification =
webFrameClient.releaseNotifications[0]; |
| 1813 ContextLifetimeTestWebFrameClient::Notification* secondReleaseNotification =
webFrameClient.releaseNotifications[1]; | 1813 ContextLifetimeTestWebFrameClient::Notification* secondReleaseNotification =
webFrameClient.releaseNotifications[1]; |
| 1814 | 1814 |
| 1815 ASSERT_TRUE(firstCreateNotification->Equals(secondReleaseNotification)); | 1815 ASSERT_TRUE(firstCreateNotification->Equals(secondReleaseNotification)); |
| 1816 ASSERT_TRUE(secondCreateNotification->Equals(firstReleaseNotification)); | 1816 ASSERT_TRUE(secondCreateNotification->Equals(firstReleaseNotification)); |
| 1817 } | 1817 } |
| 1818 | 1818 |
| 1819 TEST_F(WebFrameTest, ContextNotificationsReload) | 1819 TEST_F(WebFrameTest, ContextNotificationsReload) |
| 1820 { | 1820 { |
| 1821 v8::HandleScope handleScope; | 1821 v8::HandleScope handleScope(v8::Isolate::GetCurrent()); |
| 1822 | 1822 |
| 1823 registerMockedHttpURLLoad("context_notifications_test.html"); | 1823 registerMockedHttpURLLoad("context_notifications_test.html"); |
| 1824 registerMockedHttpURLLoad("context_notifications_test_frame.html"); | 1824 registerMockedHttpURLLoad("context_notifications_test_frame.html"); |
| 1825 | 1825 |
| 1826 ContextLifetimeTestWebFrameClient webFrameClient; | 1826 ContextLifetimeTestWebFrameClient webFrameClient; |
| 1827 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "context_noti
fications_test.html", true, &webFrameClient); | 1827 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "context_noti
fications_test.html", true, &webFrameClient); |
| 1828 | 1828 |
| 1829 // Refresh, we should get two release notifications and two more create noti
fications. | 1829 // Refresh, we should get two release notifications and two more create noti
fications. |
| 1830 m_webView->mainFrame()->reload(false); | 1830 m_webView->mainFrame()->reload(false); |
| 1831 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); | 1831 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); |
| (...skipping 1818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3650 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "push_state.h
tml", true, 0, &client); | 3650 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "push_state.h
tml", true, 0, &client); |
| 3651 runPendingTasks(); | 3651 runPendingTasks(); |
| 3652 | 3652 |
| 3653 EXPECT_EQ(client.startLoadingCount(), 2); | 3653 EXPECT_EQ(client.startLoadingCount(), 2); |
| 3654 EXPECT_EQ(client.stopLoadingCount(), 2); | 3654 EXPECT_EQ(client.stopLoadingCount(), 2); |
| 3655 m_webView->close(); | 3655 m_webView->close(); |
| 3656 m_webView = 0; | 3656 m_webView = 0; |
| 3657 } | 3657 } |
| 3658 | 3658 |
| 3659 } // namespace | 3659 } // namespace |
| OLD | NEW |