Respond with QuotaExceededError when IndexedDB has no disk space on open.
[chromium-blink-merge.git] / content / test / plugin / plugin_window_size_test.cc
blob06cecf73a2bf240aa26bdbdf1c038f9ef4cce3ff
1 // Copyright (c) 2010 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.
5 #include "content/test/plugin/plugin_window_size_test.h"
6 #include "content/test/plugin/plugin_client.h"
8 namespace NPAPIClient {
10 PluginWindowSizeTest::PluginWindowSizeTest(NPP id,
11 NPNetscapeFuncs *host_functions)
12 : PluginTest(id, host_functions) {
15 NPError PluginWindowSizeTest::SetWindow(NPWindow* pNPWindow) {
16 if (pNPWindow->window == NULL)
17 return NPERR_NO_ERROR;
19 HWND window = reinterpret_cast<HWND>(pNPWindow->window);
20 if (!::IsWindow(window)) {
21 SetError("Invalid arguments passed in");
22 return NPERR_INVALID_PARAM;
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;
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");
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");
49 SignalTestCompleted();
52 return NPERR_NO_ERROR;
55 } // namespace NPAPIClient