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

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

Issue 689163002: Clean up the page state saving mechanism. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixeds Created 6 years, 1 month 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.h » ('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"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 RenderViewImpl* view = static_cast<RenderViewImpl*>(view_); 87 RenderViewImpl* view = static_cast<RenderViewImpl*>(view_);
88 view->OnUpdateWebPreferences(prefs); 88 view->OnUpdateWebPreferences(prefs);
89 89
90 const int kMaxOutputCharacters = 1024; 90 const int kMaxOutputCharacters = 1024;
91 base::string16 output; 91 base::string16 output;
92 92
93 NSEvent* arrowDownKeyDown = CmdDeadKeyEvent(NSKeyDown, kVK_DownArrow); 93 NSEvent* arrowDownKeyDown = CmdDeadKeyEvent(NSKeyDown, kVK_DownArrow);
94 NSEvent* arrowUpKeyDown = CmdDeadKeyEvent(NSKeyDown, kVK_UpArrow); 94 NSEvent* arrowUpKeyDown = CmdDeadKeyEvent(NSKeyDown, kVK_UpArrow);
95 95
96 // First test when javascript does not eat keypresses -- should scroll. 96 // First test when javascript does not eat keypresses -- should scroll.
97 view->set_send_content_state_immediately(true); 97 view->set_page_state_sent_immediately(true);
98 LoadHTML(kRawHtml); 98 LoadHTML(kRawHtml);
99 render_thread_->sink().ClearMessages(); 99 render_thread_->sink().ClearMessages();
100 100
101 const char* kArrowDownScrollDown = "40,false,false,true,false\n10144\np1"; 101 const char* kArrowDownScrollDown = "40,false,false,true,false\n10144\np1";
102 view->OnSetEditCommandsForNextKeyEvent( 102 view->OnSetEditCommandsForNextKeyEvent(
103 EditCommands(1, EditCommand("moveToEndOfDocument", ""))); 103 EditCommands(1, EditCommand("moveToEndOfDocument", "")));
104 SendNativeKeyEvent(NativeWebKeyboardEvent(arrowDownKeyDown)); 104 SendNativeKeyEvent(NativeWebKeyboardEvent(arrowDownKeyDown));
105 ProcessPendingMessages(); 105 ProcessPendingMessages();
106 ExecuteJavaScript("scroll.textContent = window.pageYOffset"); 106 ExecuteJavaScript("scroll.textContent = window.pageYOffset");
107 output = GetMainFrame()->contentAsText(kMaxOutputCharacters); 107 output = GetMainFrame()->contentAsText(kMaxOutputCharacters);
(...skipping 26 matching lines...) Expand all
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
OLDNEW
« no previous file with comments | « content/renderer/render_view_browsertest.cc ('k') | content/renderer/render_view_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698