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

Unified Diff: content/browser/frame_host/interstitial_page_impl_browsertest.cc

Issue 2060713002: Respect the order of input messages from browser to renderer (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@2743
Patch Set: Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/renderer_host/ime_adapter_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/interstitial_page_impl_browsertest.cc
diff --git a/content/browser/frame_host/interstitial_page_impl_browsertest.cc b/content/browser/frame_host/interstitial_page_impl_browsertest.cc
index b483282f5892092d7ae2071a77e2f085248b390c..00a5bec3d2198cb4dab28aac82fd42dbb1397cd8 100644
--- a/content/browser/frame_host/interstitial_page_impl_browsertest.cc
+++ b/content/browser/frame_host/interstitial_page_impl_browsertest.cc
@@ -51,6 +51,10 @@ class TestInterstitialPageDelegate : public InterstitialPageDelegate {
" window.domAutomationController.send("
" window.getSelection().toString());"
"}"
+ "function set_selection_change_listener() {"
+ " document.addEventListener('selectionchange',"
+ " function() { document.title='SELECTION_CHANGED'; })"
+ "}"
"</script>"
"</head>"
"<body>original body text</body>"
@@ -279,6 +283,11 @@ class InterstitialPageImplTest : public ContentBrowserTest {
"create_input_and_set_text('" + text + "')");
}
+ bool SetSelectionChangeListener() {
+ return ExecuteScript(interstitial_->GetMainFrame(),
+ "set_selection_change_listener()");
+ }
+
std::string PerformCut() {
clipboard_message_watcher_->InitWait();
title_update_watcher_->InitWait("TEXT_CHANGED");
@@ -308,9 +317,11 @@ class InterstitialPageImplTest : public ContentBrowserTest {
}
void PerformSelectAll() {
+ title_update_watcher_->InitWait("SELECTION_CHANGED");
RenderFrameHostImpl* rfh =
static_cast<RenderFrameHostImpl*>(interstitial_->GetMainFrame());
rfh->GetRenderWidgetHost()->delegate()->SelectAll();
+ title_update_watcher_->Wait();
}
private:
@@ -387,12 +398,14 @@ IN_PROC_BROWSER_TEST_F(InterstitialPageImplTest, Paste) {
IN_PROC_BROWSER_TEST_F(InterstitialPageImplTest, SelectAll) {
SetUpInterstitialPage();
+ ASSERT_TRUE(SetSelectionChangeListener());
std::string input_text;
ASSERT_TRUE(GetSelection(&input_text));
EXPECT_EQ(std::string(), input_text);
PerformSelectAll();
+
ASSERT_TRUE(GetSelection(&input_text));
EXPECT_EQ("original body text", input_text);
« no previous file with comments | « no previous file | content/browser/renderer_host/ime_adapter_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698