| 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 1538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1766 | 1766 |
| 1767 virtual void willReleaseScriptContext(WebFrame* frame, v8::Handle<v8::Contex
t> context, int worldId) OVERRIDE | 1767 virtual void willReleaseScriptContext(WebFrame* frame, v8::Handle<v8::Contex
t> context, int worldId) OVERRIDE |
| 1768 { | 1768 { |
| 1769 releaseNotifications.push_back(new Notification(frame, context, worldId)
); | 1769 releaseNotifications.push_back(new Notification(frame, context, worldId)
); |
| 1770 } | 1770 } |
| 1771 }; | 1771 }; |
| 1772 | 1772 |
| 1773 // TODO(aa): Deflake this test. | 1773 // TODO(aa): Deflake this test. |
| 1774 TEST_F(WebFrameTest, FLAKY_ContextNotificationsLoadUnload) | 1774 TEST_F(WebFrameTest, FLAKY_ContextNotificationsLoadUnload) |
| 1775 { | 1775 { |
| 1776 v8::HandleScope handleScope; | 1776 v8::HandleScope handleScope(v8::Isolate::GetCurrent()); |
| 1777 | 1777 |
| 1778 registerMockedHttpURLLoad("context_notifications_test.html"); | 1778 registerMockedHttpURLLoad("context_notifications_test.html"); |
| 1779 registerMockedHttpURLLoad("context_notifications_test_frame.html"); | 1779 registerMockedHttpURLLoad("context_notifications_test_frame.html"); |
| 1780 | 1780 |
| 1781 // Load a frame with an iframe, make sure we get the right create notificati
ons. | 1781 // Load a frame with an iframe, make sure we get the right create notificati
ons. |
| 1782 ContextLifetimeTestWebFrameClient webFrameClient; | 1782 ContextLifetimeTestWebFrameClient webFrameClient; |
| 1783 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "context_noti
fications_test.html", true, &webFrameClient); | 1783 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "context_noti
fications_test.html", true, &webFrameClient); |
| 1784 | 1784 |
| 1785 WebFrame* mainFrame = m_webView->mainFrame(); | 1785 WebFrame* mainFrame = m_webView->mainFrame(); |
| 1786 WebFrame* childFrame = mainFrame->firstChild(); | 1786 WebFrame* childFrame = mainFrame->firstChild(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1806 ASSERT_EQ(2u, webFrameClient.releaseNotifications.size()); | 1806 ASSERT_EQ(2u, webFrameClient.releaseNotifications.size()); |
| 1807 ContextLifetimeTestWebFrameClient::Notification* firstReleaseNotification =
webFrameClient.releaseNotifications[0]; | 1807 ContextLifetimeTestWebFrameClient::Notification* firstReleaseNotification =
webFrameClient.releaseNotifications[0]; |
| 1808 ContextLifetimeTestWebFrameClient::Notification* secondReleaseNotification =
webFrameClient.releaseNotifications[1]; | 1808 ContextLifetimeTestWebFrameClient::Notification* secondReleaseNotification =
webFrameClient.releaseNotifications[1]; |
| 1809 | 1809 |
| 1810 ASSERT_TRUE(firstCreateNotification->Equals(secondReleaseNotification)); | 1810 ASSERT_TRUE(firstCreateNotification->Equals(secondReleaseNotification)); |
| 1811 ASSERT_TRUE(secondCreateNotification->Equals(firstReleaseNotification)); | 1811 ASSERT_TRUE(secondCreateNotification->Equals(firstReleaseNotification)); |
| 1812 } | 1812 } |
| 1813 | 1813 |
| 1814 TEST_F(WebFrameTest, ContextNotificationsReload) | 1814 TEST_F(WebFrameTest, ContextNotificationsReload) |
| 1815 { | 1815 { |
| 1816 v8::HandleScope handleScope; | 1816 v8::HandleScope handleScope(v8::Isolate::GetCurrent()); |
| 1817 | 1817 |
| 1818 registerMockedHttpURLLoad("context_notifications_test.html"); | 1818 registerMockedHttpURLLoad("context_notifications_test.html"); |
| 1819 registerMockedHttpURLLoad("context_notifications_test_frame.html"); | 1819 registerMockedHttpURLLoad("context_notifications_test_frame.html"); |
| 1820 | 1820 |
| 1821 ContextLifetimeTestWebFrameClient webFrameClient; | 1821 ContextLifetimeTestWebFrameClient webFrameClient; |
| 1822 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "context_noti
fications_test.html", true, &webFrameClient); | 1822 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "context_noti
fications_test.html", true, &webFrameClient); |
| 1823 | 1823 |
| 1824 // Refresh, we should get two release notifications and two more create noti
fications. | 1824 // Refresh, we should get two release notifications and two more create noti
fications. |
| 1825 m_webView->mainFrame()->reload(false); | 1825 m_webView->mainFrame()->reload(false); |
| 1826 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); | 1826 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); |
| (...skipping 1818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3645 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "push_state.h
tml", true, 0, &client); | 3645 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "push_state.h
tml", true, 0, &client); |
| 3646 runPendingTasks(); | 3646 runPendingTasks(); |
| 3647 | 3647 |
| 3648 EXPECT_EQ(client.startLoadingCount(), 2); | 3648 EXPECT_EQ(client.startLoadingCount(), 2); |
| 3649 EXPECT_EQ(client.stopLoadingCount(), 2); | 3649 EXPECT_EQ(client.stopLoadingCount(), 2); |
| 3650 m_webView->close(); | 3650 m_webView->close(); |
| 3651 m_webView = 0; | 3651 m_webView = 0; |
| 3652 } | 3652 } |
| 3653 | 3653 |
| 3654 } // namespace | 3654 } // namespace |
| OLD | NEW |