Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(640)

Side by Side Diff: content/renderer/render_view_browsertest_mac.mm

Issue 11090061: Fix the crash that was happening on the buildbot (but not trybots, for a strange reason) because Re… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/string_util.h" 5 #include "base/string_util.h"
6 #include "base/string16.h" 6 #include "base/string16.h"
7 #include "content/public/browser/native_web_keyboard_event.h" 7 #include "content/public/browser/native_web_keyboard_event.h"
8 #include "content/public/test/render_view_test.h" 8 #include "content/public/test/render_view_test.h"
9 #include "content/renderer/render_view_impl.h" 9 #include "content/renderer/render_view_impl.h"
10 #include "content/shell/shell_main_delegate.h"
11 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
12 11
13 #include <Cocoa/Cocoa.h> 12 #include <Cocoa/Cocoa.h>
14 #include <Carbon/Carbon.h> // for the kVK_* constants. 13 #include <Carbon/Carbon.h> // for the kVK_* constants.
15 14
16 using content::NativeWebKeyboardEvent; 15 using content::NativeWebKeyboardEvent;
17 using content::RenderViewTest; 16 using content::RenderViewTest;
18 17
19 NSEvent* CmdDeadKeyEvent(NSEventType type, unsigned short code) { 18 NSEvent* CmdDeadKeyEvent(NSEventType type, unsigned short code) {
20 UniChar uniChar = 0; 19 UniChar uniChar = 0;
(...skipping 17 matching lines...) Expand all
38 context:nil 37 context:nil
39 characters:s 38 characters:s
40 charactersIgnoringModifiers:s 39 charactersIgnoringModifiers:s
41 isARepeat:NO 40 isARepeat:NO
42 keyCode:code]; 41 keyCode:code];
43 } 42 }
44 43
45 // Test that cmd-up/down scrolls the page exactly if it is not intercepted by 44 // Test that cmd-up/down scrolls the page exactly if it is not intercepted by
46 // javascript. 45 // javascript.
47 TEST_F(RenderViewTest, MacTestCmdUp) { 46 TEST_F(RenderViewTest, MacTestCmdUp) {
48 content::ShellMainDelegate::InitializeResourceBundle();
49 // Some preprocessor trickery so that we can have literal html in our source, 47 // Some preprocessor trickery so that we can have literal html in our source,
50 // makes it easier to copy html to and from an html file for testing (the 48 // makes it easier to copy html to and from an html file for testing (the
51 // preprocessor will remove the newlines at the line ends, turning this into 49 // preprocessor will remove the newlines at the line ends, turning this into
52 // a single long line). 50 // a single long line).
53 #define HTML(s) #s 51 #define HTML(s) #s
54 const char* kRawHtml = HTML( 52 const char* kRawHtml = HTML(
55 <html> 53 <html>
56 <head><title></title> 54 <head><title></title>
57 <script type='text/javascript' language='javascript'> 55 <script type='text/javascript' language='javascript'>
58 function OnKeyEvent(ev) { 56 function OnKeyEvent(ev) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 const char* kArrowUpNoScroll = 140 const char* kArrowUpNoScroll =
143 "38,false,false,true,false\np1\n\np2"; 141 "38,false,false,true,false\np1\n\np2";
144 view->OnSetEditCommandsForNextKeyEvent( 142 view->OnSetEditCommandsForNextKeyEvent(
145 EditCommands(1, EditCommand("moveToBeginningOfDocument", ""))); 143 EditCommands(1, EditCommand("moveToBeginningOfDocument", "")));
146 SendNativeKeyEvent(NativeWebKeyboardEvent(arrowUpKeyDown)); 144 SendNativeKeyEvent(NativeWebKeyboardEvent(arrowUpKeyDown));
147 ProcessPendingMessages(); 145 ProcessPendingMessages();
148 output = GetMainFrame()->contentAsText(kMaxOutputCharacters); 146 output = GetMainFrame()->contentAsText(kMaxOutputCharacters);
149 EXPECT_EQ(kArrowUpNoScroll, UTF16ToASCII(output)); 147 EXPECT_EQ(kArrowUpNoScroll, UTF16ToASCII(output));
150 } 148 }
151 149
OLDNEW
« no previous file with comments | « content/renderer/render_view_browsertest.cc ('k') | content/renderer/render_widget_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698