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

Side by Side Diff: Source/WebKit/chromium/tests/WebFrameTest.cpp

Issue 15769013: Make WebFrameTest to not need soon-to-be-removed Persistent handle operations. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1745 matching lines...) Expand 10 before | Expand all | Expand 10 after
1756 EXPECT_EQ(childFrame, secondRefreshNotification->frame); 1756 EXPECT_EQ(childFrame, secondRefreshNotification->frame);
1757 EXPECT_EQ(childFrame->mainWorldScriptContext(), secondRefreshNotification->c ontext); 1757 EXPECT_EQ(childFrame->mainWorldScriptContext(), secondRefreshNotification->c ontext);
1758 EXPECT_EQ(0, secondRefreshNotification->worldId); 1758 EXPECT_EQ(0, secondRefreshNotification->worldId);
1759 1759
1760 m_webView->close(); 1760 m_webView->close();
1761 m_webView = 0; 1761 m_webView = 0;
1762 } 1762 }
1763 1763
1764 TEST_F(WebFrameTest, ContextNotificationsIsolatedWorlds) 1764 TEST_F(WebFrameTest, ContextNotificationsIsolatedWorlds)
1765 { 1765 {
1766 v8::HandleScope handleScope; 1766 v8::Isolate* isolate = v8::Isolate::GetCurrent();
1767 v8::HandleScope handleScope(isolate);
1767 1768
1768 registerMockedHttpURLLoad("context_notifications_test.html"); 1769 registerMockedHttpURLLoad("context_notifications_test.html");
1769 registerMockedHttpURLLoad("context_notifications_test_frame.html"); 1770 registerMockedHttpURLLoad("context_notifications_test_frame.html");
1770 1771
1771 ContextLifetimeTestWebFrameClient webFrameClient; 1772 ContextLifetimeTestWebFrameClient webFrameClient;
1772 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "context_noti fications_test.html", true, &webFrameClient); 1773 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "context_noti fications_test.html", true, &webFrameClient);
1773 1774
1774 // Add an isolated world. 1775 // Add an isolated world.
1775 webFrameClient.reset(); 1776 webFrameClient.reset();
1776 1777
1777 int isolatedWorldId = 42; 1778 int isolatedWorldId = 42;
1778 WebScriptSource scriptSource("hi!"); 1779 WebScriptSource scriptSource("hi!");
1779 int numSources = 1; 1780 int numSources = 1;
1780 int extensionGroup = 0; 1781 int extensionGroup = 0;
1781 m_webView->mainFrame()->executeScriptInIsolatedWorld(isolatedWorldId, &scrip tSource, numSources, extensionGroup); 1782 m_webView->mainFrame()->executeScriptInIsolatedWorld(isolatedWorldId, &scrip tSource, numSources, extensionGroup);
1782 1783
1783 // We should now have a new create notification. 1784 // We should now have a new create notification.
1784 ASSERT_EQ(1u, webFrameClient.createNotifications.size()); 1785 ASSERT_EQ(1u, webFrameClient.createNotifications.size());
1785 ContextLifetimeTestWebFrameClient::Notification* notification = webFrameClie nt.createNotifications[0]; 1786 ContextLifetimeTestWebFrameClient::Notification* notification = webFrameClie nt.createNotifications[0];
1786 ASSERT_EQ(isolatedWorldId, notification->worldId); 1787 ASSERT_EQ(isolatedWorldId, notification->worldId);
1787 ASSERT_EQ(m_webView->mainFrame(), notification->frame); 1788 ASSERT_EQ(m_webView->mainFrame(), notification->frame);
1788 1789
1789 // We don't have an API to enumarate isolated worlds for a frame, but we can at least assert that the context we got is *not* the main world's context. 1790 // We don't have an API to enumarate isolated worlds for a frame, but we can at least assert that the context we got is *not* the main world's context.
1790 ASSERT_NE(m_webView->mainFrame()->mainWorldScriptContext(), notification->co ntext); 1791 ASSERT_NE(m_webView->mainFrame()->mainWorldScriptContext(), v8::Local<v8::Co ntext>::New(isolate, notification->context));
1791 1792
1792 m_webView->close(); 1793 m_webView->close();
1793 m_webView = 0; 1794 m_webView = 0;
1794 1795
1795 // We should have gotten three release notifications (one for each of the fr ames, plus one for the isolated context). 1796 // We should have gotten three release notifications (one for each of the fr ames, plus one for the isolated context).
1796 ASSERT_EQ(3u, webFrameClient.releaseNotifications.size()); 1797 ASSERT_EQ(3u, webFrameClient.releaseNotifications.size());
1797 1798
1798 // And one of them should be exactly the same as the create notification for the isolated context. 1799 // And one of them should be exactly the same as the create notification for the isolated context.
1799 int matchCount = 0; 1800 int matchCount = 0;
1800 for (size_t i = 0; i < webFrameClient.releaseNotifications.size(); ++i) { 1801 for (size_t i = 0; i < webFrameClient.releaseNotifications.size(); ++i) {
(...skipping 1529 matching lines...) Expand 10 before | Expand all | Expand 10 after
3330 EXPECT_FALSE(client.wasProgrammaticScroll()); 3331 EXPECT_FALSE(client.wasProgrammaticScroll());
3331 EXPECT_TRUE(client.wasUserScroll()); 3332 EXPECT_TRUE(client.wasUserScroll());
3332 client.reset(); 3333 client.reset();
3333 3334
3334 m_webView->close(); 3335 m_webView->close();
3335 m_webView = 0; 3336 m_webView = 0;
3336 } 3337 }
3337 3338
3338 3339
3339 } // namespace 3340 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698