OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This functionality currently works on Windows and on Linux when | 5 // This functionality currently works on Windows and on Linux when |
6 // toolkit_views is defined (i.e. for Chrome OS). It's not needed | 6 // toolkit_views is defined (i.e. for Chrome OS). It's not needed |
7 // on the Mac, and it's not yet implemented on Linux. | 7 // on the Mac, and it's not yet implemented on Linux. |
8 | 8 |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 LRESULT CALLBACK SystemMenuTestCBTHook(int n_code, | 249 LRESULT CALLBACK SystemMenuTestCBTHook(int n_code, |
250 WPARAM w_param, | 250 WPARAM w_param, |
251 LPARAM l_param) { | 251 LPARAM l_param) { |
252 // Look for the system menu window getting created or becoming visible and | 252 // Look for the system menu window getting created or becoming visible and |
253 // then select the New Tab option from the menu. | 253 // then select the New Tab option from the menu. |
254 if (n_code == HCBT_ACTIVATE || n_code == HCBT_CREATEWND) { | 254 if (n_code == HCBT_ACTIVATE || n_code == HCBT_CREATEWND) { |
255 wchar_t class_name[MAX_PATH] = {0}; | 255 wchar_t class_name[MAX_PATH] = {0}; |
256 GetClassName(reinterpret_cast<HWND>(w_param), | 256 GetClassName(reinterpret_cast<HWND>(w_param), |
257 class_name, | 257 class_name, |
258 arraysize(class_name)); | 258 arraysize(class_name)); |
259 if (LowerCaseEqualsASCII(class_name, "#32768")) { | 259 if (base::LowerCaseEqualsASCII(class_name, "#32768")) { |
260 // Select the New Tab option and then send the enter key to execute it. | 260 // Select the New Tab option and then send the enter key to execute it. |
261 ::PostMessage(reinterpret_cast<HWND>(w_param), WM_CHAR, 'T', 0); | 261 ::PostMessage(reinterpret_cast<HWND>(w_param), WM_CHAR, 'T', 0); |
262 ::PostMessage(reinterpret_cast<HWND>(w_param), WM_KEYDOWN, VK_RETURN, 0); | 262 ::PostMessage(reinterpret_cast<HWND>(w_param), WM_KEYDOWN, VK_RETURN, 0); |
263 ::PostMessage(reinterpret_cast<HWND>(w_param), WM_KEYUP, VK_RETURN, 0); | 263 ::PostMessage(reinterpret_cast<HWND>(w_param), WM_KEYUP, VK_RETURN, 0); |
264 } | 264 } |
265 } | 265 } |
266 return ::CallNextHookEx(0, n_code, w_param, l_param); | 266 return ::CallNextHookEx(0, n_code, w_param, l_param); |
267 } | 267 } |
268 | 268 |
269 void KeyboardAccessTest::TestSystemMenuWithKeyboard() { | 269 void KeyboardAccessTest::TestSystemMenuWithKeyboard() { |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 browser(), ui::VKEY_BROWSER_FORWARD, false, false, false, false)); | 432 browser(), ui::VKEY_BROWSER_FORWARD, false, false, false, false)); |
433 | 433 |
434 base::string16 after_forward; | 434 base::string16 after_forward; |
435 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), &after_forward)); | 435 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), &after_forward)); |
436 | 436 |
437 EXPECT_EQ(before_back, after_forward); | 437 EXPECT_EQ(before_back, after_forward); |
438 } | 438 } |
439 #endif | 439 #endif |
440 | 440 |
441 } // namespace | 441 } // namespace |
OLD | NEW |