| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <queue> | 5 #include <queue> |
| 6 #include <set> | 6 #include <set> |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 } | 815 } |
| 816 return manager; | 816 return manager; |
| 817 } | 817 } |
| 818 | 818 |
| 819 WebViewTestBase() : guest_web_contents_(NULL), embedder_web_contents_(NULL) { | 819 WebViewTestBase() : guest_web_contents_(NULL), embedder_web_contents_(NULL) { |
| 820 GuestViewManager::set_factory_for_testing(&factory_); | 820 GuestViewManager::set_factory_for_testing(&factory_); |
| 821 } | 821 } |
| 822 | 822 |
| 823 ~WebViewTestBase() override {} | 823 ~WebViewTestBase() override {} |
| 824 | 824 |
| 825 protected: | |
| 826 scoped_refptr<content::FrameWatcher> frame_watcher_; | |
| 827 | |
| 828 private: | 825 private: |
| 829 bool UsesFakeSpeech() { | 826 bool UsesFakeSpeech() { |
| 830 const testing::TestInfo* const test_info = | 827 const testing::TestInfo* const test_info = |
| 831 testing::UnitTest::GetInstance()->current_test_info(); | 828 testing::UnitTest::GetInstance()->current_test_info(); |
| 832 | 829 |
| 833 // SpeechRecognition test specific SetUp. | 830 // SpeechRecognition test specific SetUp. |
| 834 const char* name = "SpeechRecognitionAPI_HasPermissionAllow"; | 831 const char* name = "SpeechRecognitionAPI_HasPermissionAllow"; |
| 835 return !strncmp(test_info->name(), name, strlen(name)); | 832 return !strncmp(test_info->name(), name, strlen(name)); |
| 836 } | 833 } |
| 837 | 834 |
| (...skipping 3034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3872 | 3869 |
| 3873 void SetUpCommandLine(base::CommandLine* command_line) override { | 3870 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 3874 WebViewTest::SetUpCommandLine(command_line); | 3871 WebViewTest::SetUpCommandLine(command_line); |
| 3875 | 3872 |
| 3876 command_line->AppendSwitchASCII( | 3873 command_line->AppendSwitchASCII( |
| 3877 switches::kTouchEventFeatureDetection, | 3874 switches::kTouchEventFeatureDetection, |
| 3878 switches::kTouchEventFeatureDetectionEnabled); | 3875 switches::kTouchEventFeatureDetectionEnabled); |
| 3879 } | 3876 } |
| 3880 | 3877 |
| 3881 void ForceCompositorFrame() { | 3878 void ForceCompositorFrame() { |
| 3882 if (!frame_watcher_) { | 3879 frame_watcher_.Observe(GetEmbedderWebContents()); |
| 3883 frame_watcher_ = new content::FrameWatcher(); | |
| 3884 frame_watcher_->AttachTo(GetEmbedderWebContents()); | |
| 3885 } | |
| 3886 | 3880 |
| 3887 while (!RequestFrame(GetEmbedderWebContents())) { | 3881 while (!RequestFrame(GetEmbedderWebContents())) { |
| 3888 // RequestFrame failed because we were waiting on an ack ... wait a short | 3882 // RequestFrame failed because we were waiting on an ack ... wait a short |
| 3889 // time and retry. | 3883 // time and retry. |
| 3890 base::RunLoop run_loop; | 3884 base::RunLoop run_loop; |
| 3891 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 3885 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 3892 FROM_HERE, run_loop.QuitClosure(), | 3886 FROM_HERE, run_loop.QuitClosure(), |
| 3893 base::TimeDelta::FromMilliseconds(10)); | 3887 base::TimeDelta::FromMilliseconds(10)); |
| 3894 run_loop.Run(); | 3888 run_loop.Run(); |
| 3895 } | 3889 } |
| 3896 frame_watcher_->WaitFrames(1); | 3890 frame_watcher_.WaitFrames(1); |
| 3897 } | 3891 } |
| 3898 | 3892 |
| 3899 private: | 3893 private: |
| 3900 scoped_refptr<content::FrameWatcher> frame_watcher_; | 3894 content::FrameWatcher frame_watcher_; |
| 3901 }; | 3895 }; |
| 3902 INSTANTIATE_TEST_CASE_P(WebViewTests, WebViewFocusTest, testing::Values(false)); | 3896 INSTANTIATE_TEST_CASE_P(WebViewTests, WebViewFocusTest, testing::Values(false)); |
| 3903 | 3897 |
| 3904 // The following test verifies that a views::WebView hosting an embedder | 3898 // The following test verifies that a views::WebView hosting an embedder |
| 3905 // gains focus on touchstart. | 3899 // gains focus on touchstart. |
| 3906 IN_PROC_BROWSER_TEST_P(WebViewFocusTest, TouchFocusesEmbedder) { | 3900 IN_PROC_BROWSER_TEST_P(WebViewFocusTest, TouchFocusesEmbedder) { |
| 3907 LoadAppWithGuest("web_view/accept_touch_events"); | 3901 LoadAppWithGuest("web_view/accept_touch_events"); |
| 3908 | 3902 |
| 3909 content::WebContents* web_contents = GetEmbedderWebContents(); | 3903 content::WebContents* web_contents = GetEmbedderWebContents(); |
| 3910 content::RenderViewHost* embedder_rvh = web_contents->GetRenderViewHost(); | 3904 content::RenderViewHost* embedder_rvh = web_contents->GetRenderViewHost(); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4008 ClosingChromeSignInShouldNotCrash) { | 4002 ClosingChromeSignInShouldNotCrash) { |
| 4009 GURL signin_url{"chrome://chrome-signin"}; | 4003 GURL signin_url{"chrome://chrome-signin"}; |
| 4010 | 4004 |
| 4011 AddTabAtIndex(0, signin_url, ui::PAGE_TRANSITION_TYPED); | 4005 AddTabAtIndex(0, signin_url, ui::PAGE_TRANSITION_TYPED); |
| 4012 AddTabAtIndex(1, signin_url, ui::PAGE_TRANSITION_TYPED); | 4006 AddTabAtIndex(1, signin_url, ui::PAGE_TRANSITION_TYPED); |
| 4013 WaitForWebViewInDom(); | 4007 WaitForWebViewInDom(); |
| 4014 | 4008 |
| 4015 chrome::CloseTab(browser()); | 4009 chrome::CloseTab(browser()); |
| 4016 } | 4010 } |
| 4017 #endif | 4011 #endif |
| OLD | NEW |