| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/test/plugin/plugin_windowed_test.h" | 5 #include "content/test/plugin/plugin_windowed_test.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/test/plugin/plugin_client.h" | 8 #include "content/test/plugin/plugin_client.h" |
| 9 | 9 |
| 10 namespace NPAPIClient { | 10 namespace NPAPIClient { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 if (window_) | 31 if (window_) |
| 32 return NPERR_NO_ERROR; | 32 return NPERR_NO_ERROR; |
| 33 | 33 |
| 34 HWND parent = reinterpret_cast<HWND>(pNPWindow->window); | 34 HWND parent = reinterpret_cast<HWND>(pNPWindow->window); |
| 35 if (!::IsWindow(parent)) { | 35 if (!::IsWindow(parent)) { |
| 36 SetError("Invalid arguments passed in"); | 36 SetError("Invalid arguments passed in"); |
| 37 return NPERR_INVALID_PARAM; | 37 return NPERR_INVALID_PARAM; |
| 38 } | 38 } |
| 39 | 39 |
| 40 if ((test_name() == "create_instance_in_paint" && test_id() == "1") || | 40 if ((test_name() == "create_instance_in_paint" && test_id() == "1") || |
| 41 test_name() == "alert_in_window_message" || | 41 test_name() == "alert_in_window_message") { |
| 42 test_name() == "set_title_in_paint") { | |
| 43 static ATOM window_class = 0; | 42 static ATOM window_class = 0; |
| 44 if (!window_class) { | 43 if (!window_class) { |
| 45 WNDCLASSEX wcex; | 44 WNDCLASSEX wcex; |
| 46 wcex.cbSize = sizeof(WNDCLASSEX); | 45 wcex.cbSize = sizeof(WNDCLASSEX); |
| 47 wcex.style = CS_DBLCLKS; | 46 wcex.style = CS_DBLCLKS; |
| 48 wcex.lpfnWndProc = &NPAPIClient::WindowedPluginTest::WindowProc; | 47 wcex.lpfnWndProc = &NPAPIClient::WindowedPluginTest::WindowProc; |
| 49 wcex.cbClsExtra = 0; | 48 wcex.cbClsExtra = 0; |
| 50 wcex.cbWndExtra = 0; | 49 wcex.cbWndExtra = 0; |
| 51 wcex.hInstance = GetModuleHandle(NULL); | 50 wcex.hInstance = GetModuleHandle(NULL); |
| 52 wcex.hIcon = 0; | 51 wcex.hIcon = 0; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 message == WM_PAINT) { | 126 message == WM_PAINT) { |
| 128 this_ptr->done_ = true; | 127 this_ptr->done_ = true; |
| 129 CallJSFunction(this_ptr, "CreateNewInstance"); | 128 CallJSFunction(this_ptr, "CreateNewInstance"); |
| 130 } else if (this_ptr->test_name() == "alert_in_window_message" && | 129 } else if (this_ptr->test_name() == "alert_in_window_message" && |
| 131 message == WM_PAINT) { | 130 message == WM_PAINT) { |
| 132 this_ptr->done_ = true; | 131 this_ptr->done_ = true; |
| 133 // We call this function twice as we want to display two alerts | 132 // We call this function twice as we want to display two alerts |
| 134 // and verify that we don't hang the browser. | 133 // and verify that we don't hang the browser. |
| 135 CallJSFunction(this_ptr, "CallAlert"); | 134 CallJSFunction(this_ptr, "CallAlert"); |
| 136 CallJSFunction(this_ptr, "CallAlert"); | 135 CallJSFunction(this_ptr, "CallAlert"); |
| 137 } else if (this_ptr->test_name() == "set_title_in_paint" && | |
| 138 message == WM_PAINT) { | |
| 139 this_ptr->done_ = true; | |
| 140 CallJSFunction(this_ptr, "SetTitle"); | |
| 141 } | 136 } |
| 142 | 137 |
| 143 if (this_ptr->done_) { | 138 if (this_ptr->done_) { |
| 144 ::RemoveProp(window, L"Plugin_Instance"); | 139 ::RemoveProp(window, L"Plugin_Instance"); |
| 145 } | 140 } |
| 146 } | 141 } |
| 147 | 142 |
| 148 return DefWindowProc(window, message, wparam, lparam); | 143 return DefWindowProc(window, message, wparam, lparam); |
| 149 } | 144 } |
| 150 | 145 |
| 151 } // namespace NPAPIClient | 146 } // namespace NPAPIClient |
| OLD | NEW |