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

Unified Diff: content/renderer/render_view_browsertest.cc

Issue 2470713002: [WIP Approach 1] Straighten up input method reactivation
Patch Set: fix some tests Created 4 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
Index: content/renderer/render_view_browsertest.cc
diff --git a/content/renderer/render_view_browsertest.cc b/content/renderer/render_view_browsertest.cc
index b7af1d0db0f36852c73d9f52d05a7e277316a882..af262b9ea7ddd9cdc8555968d1d53b7e1c33523b 100644
--- a/content/renderer/render_view_browsertest.cc
+++ b/content/renderer/render_view_browsertest.cc
@@ -1727,27 +1727,24 @@ TEST_F(RenderViewImplTest, MessageOrderInDidChangeSelection) {
view()->SetHandlingInputEventForTesting(true);
ExecuteJavaScriptForTests("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;
+ int first_input_type = -1;
+ int first_selection = -1;
for (size_t i = 0; i < render_thread_->sink().message_count(); ++i) {
const uint32_t type = render_thread_->sink().GetMessageAt(i)->type();
if (type == ViewHostMsg_TextInputStateChanged::ID) {
- is_input_type_called = true;
- last_input_type = i;
+ if (first_input_type == -1)
+ first_input_type = static_cast<int>(i);
} else if (type == FrameHostMsg_SelectionChanged::ID) {
- is_selection_called = true;
- last_selection = i;
+ if (first_selection == -1)
+ first_selection = static_cast<int>(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);
+ EXPECT_NE(first_input_type, -1);
+ EXPECT_NE(first_selection, -1);
+ // InputTypeChange should be called earlier than SelectionChanged.
+ EXPECT_LT(first_input_type, first_selection);
}
class RendererErrorPageTest : public RenderViewImplTest {

Powered by Google App Engine
This is Rietveld 408576698