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

Side by Side Diff: content/renderer/render_view_browsertest.cc

Issue 56643003: Start using FocusedNodedChanged to restartInput. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 11 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/basictypes.h" 5 #include "base/basictypes.h"
6 6
7 #include "base/memory/shared_memory.h" 7 #include "base/memory/shared_memory.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/win/windows_version.h" 10 #include "base/win/windows_version.h"
(...skipping 2191 matching lines...) Expand 10 before | Expand all | Expand 10 after
2202 // An event should not be sent if no favicon url exists. This is an assumption 2202 // An event should not be sent if no favicon url exists. This is an assumption
2203 // made by some of Chrome's favicon handling. 2203 // made by some of Chrome's favicon handling.
2204 LoadHTML("<html>" 2204 LoadHTML("<html>"
2205 "<head>" 2205 "<head>"
2206 "</head>" 2206 "</head>"
2207 "</html>"); 2207 "</html>");
2208 EXPECT_FALSE(render_thread_->sink().GetFirstMessageMatching( 2208 EXPECT_FALSE(render_thread_->sink().GetFirstMessageMatching(
2209 ViewHostMsg_UpdateFaviconURL::ID)); 2209 ViewHostMsg_UpdateFaviconURL::ID));
2210 } 2210 }
2211 2211
2212 TEST_F(RenderViewImplTest, FocusElementCallsFocusedNodeChanged) {
2213 LoadHTML("<input id='test1' value='hello1'></input>"
2214 "<input id='test2' value='hello2'></input>");
2215
2216 ExecuteJavaScript("document.getElementById('test1').focus();");
2217 const IPC::Message* msg1 = render_thread_->sink().GetFirstMessageMatching(
2218 ViewHostMsg_FocusedNodeChanged::ID);
2219 EXPECT_TRUE(msg1);
2220
2221 ViewHostMsg_FocusedNodeChanged::Param params;
2222 ViewHostMsg_FocusedNodeChanged::Read(msg1, &params);
2223 EXPECT_TRUE(params.a);
2224 render_thread_->sink().ClearMessages();
2225
2226 ExecuteJavaScript("document.getElementById('test2').focus();");
2227 const IPC::Message* msg2 = render_thread_->sink().GetFirstMessageMatching(
2228 ViewHostMsg_FocusedNodeChanged::ID);
2229 EXPECT_TRUE(msg2);
2230 ViewHostMsg_FocusedNodeChanged::Read(msg2, &params);
2231 EXPECT_TRUE(params.a);
2232 render_thread_->sink().ClearMessages();
2233
2234 view()->webview()->clearFocusedNode();
2235 const IPC::Message* msg3 = render_thread_->sink().GetFirstMessageMatching(
2236 ViewHostMsg_FocusedNodeChanged::ID);
2237 EXPECT_TRUE(msg3);
2238 ViewHostMsg_FocusedNodeChanged::Read(msg3, &params);
2239 EXPECT_FALSE(params.a);
2240 render_thread_->sink().ClearMessages();
2241 }
2242
2212 } // namespace content 2243 } // namespace content
OLDNEW
« no previous file with comments | « content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java ('k') | content/renderer/render_widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698