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

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

Issue 1740173003: TextIteratorAlgorithm should not force layout update in constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed my WIP comment. Created 4 years, 9 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
« no previous file with comments | « content/renderer/render_view_browsertest.cc ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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/common/web_preferences.h"
10 #include "content/public/test/render_view_test.h" 10 #include "content/public/test/render_view_test.h"
11 #include "content/renderer/render_view_impl.h" 11 #include "content/renderer/render_view_impl.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 #include "third_party/WebKit/public/web/WebFrameContentDumper.h" 13 #include "third_party/WebKit/public/web/WebFrameContentDumper.h"
14 #include "third_party/WebKit/public/web/WebLocalFrame.h" 14 #include "third_party/WebKit/public/web/WebLocalFrame.h"
15 #include "third_party/WebKit/public/web/WebView.h"
15 16
16 #include <Carbon/Carbon.h> // for the kVK_* constants. 17 #include <Carbon/Carbon.h> // for the kVK_* constants.
17 #include <Cocoa/Cocoa.h> 18 #include <Cocoa/Cocoa.h>
18 19
19 using blink::WebFrameContentDumper; 20 using blink::WebFrameContentDumper;
20 21
21 namespace content { 22 namespace content {
22 23
23 NSEvent* CmdDeadKeyEvent(NSEventType type, unsigned short code) { 24 NSEvent* CmdDeadKeyEvent(NSEventType type, unsigned short code) {
24 UniChar uniChar = 0; 25 UniChar uniChar = 0;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 view->set_send_content_state_immediately(true); 101 view->set_send_content_state_immediately(true);
101 LoadHTML(kRawHtml); 102 LoadHTML(kRawHtml);
102 render_thread_->sink().ClearMessages(); 103 render_thread_->sink().ClearMessages();
103 104
104 const char* kArrowDownScrollDown = "40,false,false,true,false\n10144\np1"; 105 const char* kArrowDownScrollDown = "40,false,false,true,false\n10144\np1";
105 view->OnSetEditCommandsForNextKeyEvent( 106 view->OnSetEditCommandsForNextKeyEvent(
106 EditCommands(1, EditCommand("moveToEndOfDocument", ""))); 107 EditCommands(1, EditCommand("moveToEndOfDocument", "")));
107 SendNativeKeyEvent(NativeWebKeyboardEvent(arrowDownKeyDown)); 108 SendNativeKeyEvent(NativeWebKeyboardEvent(arrowDownKeyDown));
108 ProcessPendingMessages(); 109 ProcessPendingMessages();
109 ExecuteJavaScriptForTests("scroll.textContent = window.pageYOffset"); 110 ExecuteJavaScriptForTests("scroll.textContent = window.pageYOffset");
111 view->GetWebView()->updateAllLifecyclePhases();
110 output = WebFrameContentDumper::dumpFrameTreeAsText(GetMainFrame(), 112 output = WebFrameContentDumper::dumpFrameTreeAsText(GetMainFrame(),
111 kMaxOutputCharacters); 113 kMaxOutputCharacters);
112 EXPECT_EQ(kArrowDownScrollDown, base::UTF16ToASCII(output)); 114 EXPECT_EQ(kArrowDownScrollDown, base::UTF16ToASCII(output));
113 115
114 const char* kArrowUpScrollUp = "38,false,false,true,false\n0\np1"; 116 const char* kArrowUpScrollUp = "38,false,false,true,false\n0\np1";
115 view->OnSetEditCommandsForNextKeyEvent( 117 view->OnSetEditCommandsForNextKeyEvent(
116 EditCommands(1, EditCommand("moveToBeginningOfDocument", ""))); 118 EditCommands(1, EditCommand("moveToBeginningOfDocument", "")));
117 SendNativeKeyEvent(NativeWebKeyboardEvent(arrowUpKeyDown)); 119 SendNativeKeyEvent(NativeWebKeyboardEvent(arrowUpKeyDown));
118 ProcessPendingMessages(); 120 ProcessPendingMessages();
119 ExecuteJavaScriptForTests("scroll.textContent = window.pageYOffset"); 121 ExecuteJavaScriptForTests("scroll.textContent = window.pageYOffset");
122 view->GetWebView()->updateAllLifecyclePhases();
120 output = WebFrameContentDumper::dumpFrameTreeAsText(GetMainFrame(), 123 output = WebFrameContentDumper::dumpFrameTreeAsText(GetMainFrame(),
121 kMaxOutputCharacters); 124 kMaxOutputCharacters);
122 EXPECT_EQ(kArrowUpScrollUp, base::UTF16ToASCII(output)); 125 EXPECT_EQ(kArrowUpScrollUp, base::UTF16ToASCII(output));
123 126
124 // Now let javascript eat the key events -- no scrolling should happen. 127 // Now let javascript eat the key events -- no scrolling should happen.
125 // Set a scroll position slightly down the page to ensure that it does not 128 // Set a scroll position slightly down the page to ensure that it does not
126 // move. 129 // move.
127 ExecuteJavaScriptForTests("allowKeyEvents = false; window.scrollTo(0, 100)"); 130 ExecuteJavaScriptForTests("allowKeyEvents = false; window.scrollTo(0, 100)");
128 131
129 const char* kArrowDownNoScroll = "40,false,false,true,false\n100\np1"; 132 const char* kArrowDownNoScroll = "40,false,false,true,false\n100\np1";
130 view->OnSetEditCommandsForNextKeyEvent( 133 view->OnSetEditCommandsForNextKeyEvent(
131 EditCommands(1, EditCommand("moveToEndOfDocument", ""))); 134 EditCommands(1, EditCommand("moveToEndOfDocument", "")));
132 SendNativeKeyEvent(NativeWebKeyboardEvent(arrowDownKeyDown)); 135 SendNativeKeyEvent(NativeWebKeyboardEvent(arrowDownKeyDown));
133 ProcessPendingMessages(); 136 ProcessPendingMessages();
134 ExecuteJavaScriptForTests("scroll.textContent = window.pageYOffset"); 137 ExecuteJavaScriptForTests("scroll.textContent = window.pageYOffset");
138 view->GetWebView()->updateAllLifecyclePhases();
135 output = WebFrameContentDumper::dumpFrameTreeAsText(GetMainFrame(), 139 output = WebFrameContentDumper::dumpFrameTreeAsText(GetMainFrame(),
136 kMaxOutputCharacters); 140 kMaxOutputCharacters);
137 EXPECT_EQ(kArrowDownNoScroll, base::UTF16ToASCII(output)); 141 EXPECT_EQ(kArrowDownNoScroll, base::UTF16ToASCII(output));
138 142
139 const char* kArrowUpNoScroll = "38,false,false,true,false\n100\np1"; 143 const char* kArrowUpNoScroll = "38,false,false,true,false\n100\np1";
140 view->OnSetEditCommandsForNextKeyEvent( 144 view->OnSetEditCommandsForNextKeyEvent(
141 EditCommands(1, EditCommand("moveToBeginningOfDocument", ""))); 145 EditCommands(1, EditCommand("moveToBeginningOfDocument", "")));
142 SendNativeKeyEvent(NativeWebKeyboardEvent(arrowUpKeyDown)); 146 SendNativeKeyEvent(NativeWebKeyboardEvent(arrowUpKeyDown));
143 ProcessPendingMessages(); 147 ProcessPendingMessages();
144 ExecuteJavaScriptForTests("scroll.textContent = window.pageYOffset"); 148 ExecuteJavaScriptForTests("scroll.textContent = window.pageYOffset");
149 view->GetWebView()->updateAllLifecyclePhases();
145 output = WebFrameContentDumper::dumpFrameTreeAsText(GetMainFrame(), 150 output = WebFrameContentDumper::dumpFrameTreeAsText(GetMainFrame(),
146 kMaxOutputCharacters); 151 kMaxOutputCharacters);
147 EXPECT_EQ(kArrowUpNoScroll, base::UTF16ToASCII(output)); 152 EXPECT_EQ(kArrowUpNoScroll, base::UTF16ToASCII(output));
148 } 153 }
149 154
150 } // namespace content 155 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_view_browsertest.cc ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698