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

Unified Diff: content/renderer/render_view_browsertest.cc

Issue 33323003: Fix the order of the event dispatch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a test case. Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/renderer/render_view_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_view_browsertest.cc
diff --git a/content/renderer/render_view_browsertest.cc b/content/renderer/render_view_browsertest.cc
index 195f694390f790d3d59f9e7deb6b3503e8bd3d18..b7afb5fa0babd472c5d20108d676f263fd9ba522 100644
--- a/content/renderer/render_view_browsertest.cc
+++ b/content/renderer/render_view_browsertest.cc
@@ -1958,6 +1958,37 @@ TEST_F(RenderViewImplTest, GetSSLStatusOfFrame) {
EXPECT_TRUE(net::IsCertStatusError(ssl_status.cert_status));
}
+TEST_F(RenderViewImplTest, MessageOrderInDidChangeSelection) {
+ view()->OnSetInputMethodActive(true);
+ view()->set_send_content_state_immediately(true);
+ LoadHTML("<textarea id=\"test\"></textarea>");
+
+ view()->handling_input_event_ = true;
+ ExecuteJavaScript("document.getElementById('test').focus();");
+
+ bool is_input_type_called = false;
+ bool is_selection_called = false;
+ size_t last_input_type = 0;
+ size_t last_selection = 0;
+
+ for (size_t i = 0; i < render_thread_->sink().message_count(); ++i) {
+ const uint32 type = render_thread_->sink().GetMessageAt(i)->type();
+ if (type == ViewHostMsg_TextInputTypeChanged::ID) {
+ is_input_type_called = true;
+ last_input_type = i;
+ } else if (type == ViewHostMsg_SelectionChanged::ID) {
+ is_selection_called = true;
+ last_selection = i;
+ }
+ }
+
+ EXPECT_TRUE(is_input_type_called);
+ EXPECT_TRUE(is_selection_called);
+
+ // InputTypeChange shold be called earlier than SelectionChanged.
+ EXPECT_LT(last_input_type, last_selection);
+}
+
class SuppressErrorPageTest : public RenderViewTest {
public:
virtual void SetUp() OVERRIDE {
« no previous file with comments | « no previous file | content/renderer/render_view_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698