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 #include "base/strings/string16.h" | 5 #include "base/strings/string16.h" |
6 #include "base/strings/string_util.h" | 6 #include "base/strings/string_util.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "content/public/browser/native_web_keyboard_event.h" | 8 #include "content/public/browser/native_web_keyboard_event.h" |
| 9 #include "content/public/common/web_preferences.h" |
9 #include "content/public/test/render_view_test.h" | 10 #include "content/public/test/render_view_test.h" |
10 #include "content/renderer/render_view_impl.h" | 11 #include "content/renderer/render_view_impl.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
12 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 13 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
13 #include "webkit/common/webpreferences.h" | |
14 | 14 |
| 15 #include <Carbon/Carbon.h> // for the kVK_* constants. |
15 #include <Cocoa/Cocoa.h> | 16 #include <Cocoa/Cocoa.h> |
16 #include <Carbon/Carbon.h> // for the kVK_* constants. | |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 NSEvent* CmdDeadKeyEvent(NSEventType type, unsigned short code) { | 20 NSEvent* CmdDeadKeyEvent(NSEventType type, unsigned short code) { |
21 UniChar uniChar = 0; | 21 UniChar uniChar = 0; |
22 switch(code) { | 22 switch(code) { |
23 case kVK_UpArrow: | 23 case kVK_UpArrow: |
24 uniChar = NSUpArrowFunctionKey; | 24 uniChar = NSUpArrowFunctionKey; |
25 break; | 25 break; |
26 case kVK_DownArrow: | 26 case kVK_DownArrow: |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 view->OnSetEditCommandsForNextKeyEvent( | 134 view->OnSetEditCommandsForNextKeyEvent( |
135 EditCommands(1, EditCommand("moveToBeginningOfDocument", ""))); | 135 EditCommands(1, EditCommand("moveToBeginningOfDocument", ""))); |
136 SendNativeKeyEvent(NativeWebKeyboardEvent(arrowUpKeyDown)); | 136 SendNativeKeyEvent(NativeWebKeyboardEvent(arrowUpKeyDown)); |
137 ProcessPendingMessages(); | 137 ProcessPendingMessages(); |
138 ExecuteJavaScript("scroll.textContent = window.pageYOffset"); | 138 ExecuteJavaScript("scroll.textContent = window.pageYOffset"); |
139 output = GetMainFrame()->contentAsText(kMaxOutputCharacters); | 139 output = GetMainFrame()->contentAsText(kMaxOutputCharacters); |
140 EXPECT_EQ(kArrowUpNoScroll, base::UTF16ToASCII(output)); | 140 EXPECT_EQ(kArrowUpNoScroll, base::UTF16ToASCII(output)); |
141 } | 141 } |
142 | 142 |
143 } // namespace content | 143 } // namespace content |
OLD | NEW |