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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 LRESULT CALLBACK SystemMenuTestCBTHook(int n_code, | 250 LRESULT CALLBACK SystemMenuTestCBTHook(int n_code, |
251 WPARAM w_param, | 251 WPARAM w_param, |
252 LPARAM l_param) { | 252 LPARAM l_param) { |
253 // Look for the system menu window getting created or becoming visible and | 253 // Look for the system menu window getting created or becoming visible and |
254 // then select the New Tab option from the menu. | 254 // then select the New Tab option from the menu. |
255 if (n_code == HCBT_ACTIVATE || n_code == HCBT_CREATEWND) { | 255 if (n_code == HCBT_ACTIVATE || n_code == HCBT_CREATEWND) { |
256 wchar_t class_name[MAX_PATH] = {0}; | 256 wchar_t class_name[MAX_PATH] = {0}; |
257 GetClassName(reinterpret_cast<HWND>(w_param), | 257 GetClassName(reinterpret_cast<HWND>(w_param), |
258 class_name, | 258 class_name, |
259 arraysize(class_name)); | 259 arraysize(class_name)); |
260 if (LowerCaseEqualsASCII(class_name, "#32768")) { | 260 if (base::LowerCaseEqualsASCII(class_name, "#32768")) { |
261 // Select the New Tab option and then send the enter key to execute it. | 261 // Select the New Tab option and then send the enter key to execute it. |
262 ::PostMessage(reinterpret_cast<HWND>(w_param), WM_CHAR, 'T', 0); | 262 ::PostMessage(reinterpret_cast<HWND>(w_param), WM_CHAR, 'T', 0); |
263 ::PostMessage(reinterpret_cast<HWND>(w_param), WM_KEYDOWN, VK_RETURN, 0); | 263 ::PostMessage(reinterpret_cast<HWND>(w_param), WM_KEYDOWN, VK_RETURN, 0); |
264 ::PostMessage(reinterpret_cast<HWND>(w_param), WM_KEYUP, VK_RETURN, 0); | 264 ::PostMessage(reinterpret_cast<HWND>(w_param), WM_KEYUP, VK_RETURN, 0); |
265 } | 265 } |
266 } | 266 } |
267 return ::CallNextHookEx(0, n_code, w_param, l_param); | 267 return ::CallNextHookEx(0, n_code, w_param, l_param); |
268 } | 268 } |
269 | 269 |
270 void KeyboardAccessTest::TestSystemMenuWithKeyboard() { | 270 void KeyboardAccessTest::TestSystemMenuWithKeyboard() { |
(...skipping 161 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 |