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

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

Issue 967213004: Removed FrameView's windowToContents and contentsToWindow methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 9 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
« no previous file with comments | « Source/web/tests/TouchActionTest.cpp ('k') | Source/web/tests/WebViewTest.cpp » ('j') | 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 FrameTestHelpers::WebViewHelper webViewHelper; 110 FrameTestHelpers::WebViewHelper webViewHelper;
111 WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "plugin_conta iner.html", true, new TestPluginWebFrameClient()); 111 WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "plugin_conta iner.html", true, new TestPluginWebFrameClient());
112 ASSERT(webView); 112 ASSERT(webView);
113 webView->settings()->setPluginsEnabled(true); 113 webView->settings()->setPluginsEnabled(true);
114 webView->resize(WebSize(300, 300)); 114 webView->resize(WebSize(300, 300));
115 webView->layout(); 115 webView->layout();
116 runPendingTasks(); 116 runPendingTasks();
117 117
118 WebPluginContainer* pluginContainerOne = getWebPluginContainer(webView, WebS tring::fromUTF8("translated-plugin")); 118 WebPluginContainer* pluginContainerOne = getWebPluginContainer(webView, WebS tring::fromUTF8("translated-plugin"));
119 ASSERT(pluginContainerOne); 119 ASSERT(pluginContainerOne);
120 WebPoint point1 = pluginContainerOne->windowToLocalPoint(WebPoint(10, 10)); 120 WebPoint point1 = pluginContainerOne->rootFrameToLocalPoint(WebPoint(10, 10) );
121 ASSERT_EQ(0, point1.x); 121 ASSERT_EQ(0, point1.x);
122 ASSERT_EQ(0, point1.y); 122 ASSERT_EQ(0, point1.y);
123 WebPoint point2 = pluginContainerOne->windowToLocalPoint(WebPoint(100, 100)) ; 123 WebPoint point2 = pluginContainerOne->rootFrameToLocalPoint(WebPoint(100, 10 0));
124 ASSERT_EQ(90, point2.x); 124 ASSERT_EQ(90, point2.x);
125 ASSERT_EQ(90, point2.y); 125 ASSERT_EQ(90, point2.y);
126 126
127 WebPluginContainer* pluginContainerTwo = getWebPluginContainer(webView, WebS tring::fromUTF8("rotated-plugin")); 127 WebPluginContainer* pluginContainerTwo = getWebPluginContainer(webView, WebS tring::fromUTF8("rotated-plugin"));
128 ASSERT(pluginContainerTwo); 128 ASSERT(pluginContainerTwo);
129 WebPoint point3 = pluginContainerTwo->windowToLocalPoint(WebPoint(0, 10)); 129 WebPoint point3 = pluginContainerTwo->rootFrameToLocalPoint(WebPoint(0, 10)) ;
130 ASSERT_EQ(10, point3.x); 130 ASSERT_EQ(10, point3.x);
131 ASSERT_EQ(0, point3.y); 131 ASSERT_EQ(0, point3.y);
132 WebPoint point4 = pluginContainerTwo->windowToLocalPoint(WebPoint(-10, 10)); 132 WebPoint point4 = pluginContainerTwo->rootFrameToLocalPoint(WebPoint(-10, 10 ));
133 ASSERT_EQ(10, point4.x); 133 ASSERT_EQ(10, point4.x);
134 ASSERT_EQ(10, point4.y); 134 ASSERT_EQ(10, point4.y);
135 } 135 }
136 136
137 TEST_F(WebPluginContainerTest, LocalToWindowPointTest) 137 TEST_F(WebPluginContainerTest, LocalToWindowPointTest)
138 { 138 {
139 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("plugin_container.html")); 139 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("plugin_container.html"));
140 FrameTestHelpers::WebViewHelper webViewHelper; 140 FrameTestHelpers::WebViewHelper webViewHelper;
141 WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "plugin_conta iner.html", true, new TestPluginWebFrameClient()); 141 WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "plugin_conta iner.html", true, new TestPluginWebFrameClient());
142 ASSERT(webView); 142 ASSERT(webView);
143 webView->settings()->setPluginsEnabled(true); 143 webView->settings()->setPluginsEnabled(true);
144 webView->resize(WebSize(300, 300)); 144 webView->resize(WebSize(300, 300));
145 webView->layout(); 145 webView->layout();
146 runPendingTasks(); 146 runPendingTasks();
147 147
148 WebPluginContainer* pluginContainerOne = getWebPluginContainer(webView, WebS tring::fromUTF8("translated-plugin")); 148 WebPluginContainer* pluginContainerOne = getWebPluginContainer(webView, WebS tring::fromUTF8("translated-plugin"));
149 ASSERT(pluginContainerOne); 149 ASSERT(pluginContainerOne);
150 WebPoint point1 = pluginContainerOne->localToWindowPoint(WebPoint(0, 0)); 150 WebPoint point1 = pluginContainerOne->localToRootFramePoint(WebPoint(0, 0));
151 ASSERT_EQ(10, point1.x); 151 ASSERT_EQ(10, point1.x);
152 ASSERT_EQ(10, point1.y); 152 ASSERT_EQ(10, point1.y);
153 WebPoint point2 = pluginContainerOne->localToWindowPoint(WebPoint(90, 90)); 153 WebPoint point2 = pluginContainerOne->localToRootFramePoint(WebPoint(90, 90) );
154 ASSERT_EQ(100, point2.x); 154 ASSERT_EQ(100, point2.x);
155 ASSERT_EQ(100, point2.y); 155 ASSERT_EQ(100, point2.y);
156 156
157 WebPluginContainer* pluginContainerTwo = getWebPluginContainer(webView, WebS tring::fromUTF8("rotated-plugin")); 157 WebPluginContainer* pluginContainerTwo = getWebPluginContainer(webView, WebS tring::fromUTF8("rotated-plugin"));
158 ASSERT(pluginContainerTwo); 158 ASSERT(pluginContainerTwo);
159 WebPoint point3 = pluginContainerTwo->localToWindowPoint(WebPoint(10, 0)); 159 WebPoint point3 = pluginContainerTwo->localToRootFramePoint(WebPoint(10, 0)) ;
160 ASSERT_EQ(0, point3.x); 160 ASSERT_EQ(0, point3.x);
161 ASSERT_EQ(10, point3.y); 161 ASSERT_EQ(10, point3.y);
162 WebPoint point4 = pluginContainerTwo->localToWindowPoint(WebPoint(10, 10)); 162 WebPoint point4 = pluginContainerTwo->localToRootFramePoint(WebPoint(10, 10) );
163 ASSERT_EQ(-10, point4.x); 163 ASSERT_EQ(-10, point4.x);
164 ASSERT_EQ(10, point4.y); 164 ASSERT_EQ(10, point4.y);
165 } 165 }
166 166
167 // Verifies executing the command 'Copy' results in copying to the clipboard. 167 // Verifies executing the command 'Copy' results in copying to the clipboard.
168 TEST_F(WebPluginContainerTest, Copy) 168 TEST_F(WebPluginContainerTest, Copy)
169 { 169 {
170 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("plugin_container.html")); 170 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("plugin_container.html"));
171 FrameTestHelpers::WebViewHelper webViewHelper; 171 FrameTestHelpers::WebViewHelper webViewHelper;
172 WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "plugin_conta iner.html", true, new TestPluginWebFrameClient()); 172 WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "plugin_conta iner.html", true, new TestPluginWebFrameClient());
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 // Clearing |Clipboard::Buffer()|. 209 // Clearing |Clipboard::Buffer()|.
210 Platform::current()->clipboard()->writePlainText(WebString("")); 210 Platform::current()->clipboard()->writePlainText(WebString(""));
211 EXPECT_EQ(WebString(""), Platform::current()->clipboard()->readPlainText(Web Clipboard::Buffer())); 211 EXPECT_EQ(WebString(""), Platform::current()->clipboard()->readPlainText(Web Clipboard::Buffer()));
212 212
213 PlatformKeyboardEvent platformKeyboardEventInsert(PlatformEvent::RawKeyDown, "", "", "45", "", 45, 0, false, false, false, modifierKey, 0.0); 213 PlatformKeyboardEvent platformKeyboardEventInsert(PlatformEvent::RawKeyDown, "", "", "45", "", 45, 0, false, false, false, modifierKey, 0.0);
214 RefPtrWillBeRawPtr<KeyboardEvent> keyEventInsert = KeyboardEvent::create(pla tformKeyboardEventInsert, 0); 214 RefPtrWillBeRawPtr<KeyboardEvent> keyEventInsert = KeyboardEvent::create(pla tformKeyboardEventInsert, 0);
215 ((WebPluginContainerImpl*)(pluginContainerOneElement.pluginContainer()))->ha ndleEvent(keyEventInsert.get()); 215 ((WebPluginContainerImpl*)(pluginContainerOneElement.pluginContainer()))->ha ndleEvent(keyEventInsert.get());
216 EXPECT_EQ(WebString("x"), Platform::current()->clipboard()->readPlainText(We bClipboard::Buffer())); 216 EXPECT_EQ(WebString("x"), Platform::current()->clipboard()->readPlainText(We bClipboard::Buffer()));
217 } 217 }
218 } 218 }
OLDNEW
« no previous file with comments | « Source/web/tests/TouchActionTest.cpp ('k') | Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698