cef/tests/unittests/os_rendering_unittest_mac.mm
Marshall Greenblatt 243a9c26d7 Update to Chromium revision 0bfd25d4 (#381305)
- Delete include/cef_runnable.h (issue #1336).
- Build the cef_unittests target using all Chromium headers. Add a
  USING_CHROMIUM_INCLUDES define and libcef_dll_wrapper_unittests
  target to support this. This change avoids compile errors due to
  the divergence of CEF and Chromium base/ header implementations.
  The libcef_dll_wrapper sources must now compile successfully with
  both CEF and Chromium base/ headers (issue #1632).
- The onbeforeunload message specified via JavaScript is no longer
  passed to the client (see http://crbug.com/587940).
2016-03-17 13:01:21 -04:00

40 lines
1.3 KiB
Plaintext

// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file.
#import <AppKit/AppKit.h>
#import <Cocoa/Cocoa.h>
#include "os_rendering_unittest_mac.h"
#include "ui/events/keycodes/keyboard_code_conversion_mac.h"
#include "include/cef_base.h"
namespace osr_unittests {
CefWindowHandle GetFakeView() {
NSScreen *mainScreen = [NSScreen mainScreen];
NSRect screenRect = [mainScreen visibleFrame];
NSView* fakeView = [[NSView alloc] initWithFrame: screenRect];
return fakeView;
}
void GetKeyEvent(CefKeyEvent& event, ui::KeyboardCode keyCode, int modifiers) {
unichar character;
unichar unmodified_character;
// TODO(port): translate modifiers from the input format to NSFlags
// MacKeyCodeForWindowsKeyCode takes a NSUinteger as flags.
int macKeyCode = ui::MacKeyCodeForWindowsKeyCode(keyCode,
modifiers,
&character,
&unmodified_character);
event.native_key_code = macKeyCode;
event.character = character;
event.unmodified_character = unmodified_character;
}
} // namespace osr_unittests