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

Side by Side Diff: webkit/glue/plugins/test/plugin_window_size_test.cc

Issue 6012002: Move the NPAPI files from webkit/glue/plugins to webkit/plugins/npapi and put... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years 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
OLDNEW
(Empty)
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "webkit/glue/plugins/test/plugin_window_size_test.h"
6 #include "webkit/glue/plugins/test/plugin_client.h"
7
8 namespace NPAPIClient {
9
10 PluginWindowSizeTest::PluginWindowSizeTest(NPP id,
11 NPNetscapeFuncs *host_functions)
12 : PluginTest(id, host_functions) {
13 }
14
15 NPError PluginWindowSizeTest::SetWindow(NPWindow* pNPWindow) {
16 if (pNPWindow->window == NULL)
17 return NPERR_NO_ERROR;
18
19 HWND window = reinterpret_cast<HWND>(pNPWindow->window);
20 if (!pNPWindow || !::IsWindow(window)) {
21 SetError("Invalid arguments passed in");
22 return NPERR_INVALID_PARAM;
23 }
24
25 RECT window_rect = {0};
26 window_rect.left = pNPWindow->x;
27 window_rect.top = pNPWindow->y;
28 window_rect.right = pNPWindow->width;
29 window_rect.bottom = pNPWindow->height;
30
31 if (!::IsRectEmpty(&window_rect)) {
32 RECT client_rect = {0};
33 ::GetClientRect(window, &client_rect);
34 if (::IsRectEmpty(&client_rect)) {
35 SetError("The client rect of the plugin window is empty. Test failed");
36 }
37
38 // Bug 6742: ensure that the coordinates passed in are relative to the
39 // parent HWND.
40 POINT origin_from_os;
41 RECT window_rect_from_os;
42 ::GetWindowRect(window, &window_rect_from_os);
43 origin_from_os.x = window_rect_from_os.left;
44 origin_from_os.y = window_rect_from_os.top;
45 ::ScreenToClient(GetParent(window), &origin_from_os);
46 if (origin_from_os.x != pNPWindow->x || origin_from_os.y != pNPWindow->y)
47 SetError("Wrong position passed in to SetWindow! Test failed");
48
49 SignalTestCompleted();
50 }
51
52 return NPERR_NO_ERROR;
53 }
54
55 } // namespace NPAPIClient
OLDNEW
« no previous file with comments | « webkit/glue/plugins/test/plugin_window_size_test.h ('k') | webkit/glue/plugins/test/plugin_windowed_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698