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") { |
42 static ATOM window_class = 0; | 43 static ATOM window_class = 0; |
43 if (!window_class) { | 44 if (!window_class) { |
44 WNDCLASSEX wcex; | 45 WNDCLASSEX wcex; |
45 wcex.cbSize = sizeof(WNDCLASSEX); | 46 wcex.cbSize = sizeof(WNDCLASSEX); |
46 wcex.style = CS_DBLCLKS; | 47 wcex.style = CS_DBLCLKS; |
47 wcex.lpfnWndProc = &NPAPIClient::WindowedPluginTest::WindowProc; | 48 wcex.lpfnWndProc = &NPAPIClient::WindowedPluginTest::WindowProc; |
48 wcex.cbClsExtra = 0; | 49 wcex.cbClsExtra = 0; |
49 wcex.cbWndExtra = 0; | 50 wcex.cbWndExtra = 0; |
50 wcex.hInstance = GetModuleHandle(NULL); | 51 wcex.hInstance = GetModuleHandle(NULL); |
51 wcex.hIcon = 0; | 52 wcex.hIcon = 0; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 message == WM_PAINT) { | 127 message == WM_PAINT) { |
127 this_ptr->done_ = true; | 128 this_ptr->done_ = true; |
128 CallJSFunction(this_ptr, "CreateNewInstance"); | 129 CallJSFunction(this_ptr, "CreateNewInstance"); |
129 } else if (this_ptr->test_name() == "alert_in_window_message" && | 130 } else if (this_ptr->test_name() == "alert_in_window_message" && |
130 message == WM_PAINT) { | 131 message == WM_PAINT) { |
131 this_ptr->done_ = true; | 132 this_ptr->done_ = true; |
132 // We call this function twice as we want to display two alerts | 133 // We call this function twice as we want to display two alerts |
133 // and verify that we don't hang the browser. | 134 // and verify that we don't hang the browser. |
134 CallJSFunction(this_ptr, "CallAlert"); | 135 CallJSFunction(this_ptr, "CallAlert"); |
135 CallJSFunction(this_ptr, "CallAlert"); | 136 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"); |
136 } | 141 } |
137 | 142 |
138 if (this_ptr->done_) { | 143 if (this_ptr->done_) { |
139 ::RemoveProp(window, L"Plugin_Instance"); | 144 ::RemoveProp(window, L"Plugin_Instance"); |
140 } | 145 } |
141 } | 146 } |
142 | 147 |
143 return DefWindowProc(window, message, wparam, lparam); | 148 return DefWindowProc(window, message, wparam, lparam); |
144 } | 149 } |
145 | 150 |
146 } // namespace NPAPIClient | 151 } // namespace NPAPIClient |
OLD | NEW |