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

Unified Diff: chrome/browser/apps/guest_view/web_view_browsertest.cc

Issue 1412923009: Route touch-events for WebViewGuest directly to guest renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Mac code, rebase to master@{#361742}. Created 5 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: chrome/browser/apps/guest_view/web_view_browsertest.cc
diff --git a/chrome/browser/apps/guest_view/web_view_browsertest.cc b/chrome/browser/apps/guest_view/web_view_browsertest.cc
index 337b21f86c402e06e6034424ff1bdcbe7008057b..1759669acbb4c36d65c60bf4bf9b4072efe4986e 100644
--- a/chrome/browser/apps/guest_view/web_view_browsertest.cc
+++ b/chrome/browser/apps/guest_view/web_view_browsertest.cc
@@ -2796,38 +2796,6 @@ class WebViewFocusTest : public WebViewTest {
scoped_refptr<content::FrameWatcher> frame_watcher_;
};
-class FocusWaiter : public views::FocusChangeListener {
- public:
- explicit FocusWaiter(views::View* view_to_wait_for)
- : view_to_wait_for_(view_to_wait_for) {
- view_to_wait_for_->GetFocusManager()->AddFocusChangeListener(this);
- }
- ~FocusWaiter() override {
- view_to_wait_for_->GetFocusManager()->RemoveFocusChangeListener(this);
- }
-
- void Wait() {
- if (view_to_wait_for_->HasFocus())
- return;
-
- base::MessageLoop::current()->Run();
- }
-
- // FocusChangeListener implementation.
- void OnWillChangeFocus(views::View* focused_before,
- views::View* focused_now) override {}
- void OnDidChangeFocus(views::View* focused_before,
- views::View* focused_now) override {
- if (view_to_wait_for_ == focused_now)
- base::MessageLoop::current()->QuitWhenIdle();
- }
-
- private:
- views::View* view_to_wait_for_;
-
- DISALLOW_COPY_AND_ASSIGN(FocusWaiter);
-};
-
// The following test verifies that a views::WebView hosting an embedder
// gains focus on touchstart.
IN_PROC_BROWSER_TEST_F(WebViewFocusTest, TouchFocusesEmbedder) {
@@ -2887,13 +2855,9 @@ IN_PROC_BROWSER_TEST_F(WebViewFocusTest, TouchFocusesEmbedder) {
guest_rect.Offset(-embedder_origin.x(), -embedder_origin.y());
// Generate and send synthetic touch event.
- FocusWaiter waiter(aura_webview);
content::SimulateTouchPressAt(GetEmbedderWebContents(),
guest_rect.CenterPoint());
-
- // Wait for the TouchStart to propagate and restore focus. Test times out
- // on failure.
- waiter.Wait();
+ EXPECT_TRUE(aura_webview->HasFocus());
}
#endif

Powered by Google App Engine
This is Rietveld 408576698