| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/chrome_content_browser_client.h" | 9 #include "chrome/browser/chrome_content_browser_client.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 ui::DomCode::US_E, ui::VKEY_E, false, false, false, false); | 864 ui::DomCode::US_E, ui::VKEY_E, false, false, false, false); |
| 865 bounds_observer.Wait(); | 865 bounds_observer.Wait(); |
| 866 }; | 866 }; |
| 867 | 867 |
| 868 for (auto* view : views) | 868 for (auto* view : views) |
| 869 send_tab_insert_text_wait_for_bounds_change(view); | 869 send_tab_insert_text_wait_for_bounds_change(view); |
| 870 } | 870 } |
| 871 | 871 |
| 872 // This test makes sure browser correctly tracks focused editable element inside | 872 // This test makes sure browser correctly tracks focused editable element inside |
| 873 // each RenderFrameHost. | 873 // each RenderFrameHost. |
| 874 // Test is flaky on ChromeOS. crbug.com/705203 | 874 // Test is flaky. crbug.com/705203 |
| 875 #if defined(OS_CHROMEOS) | |
| 876 #define MAYBE_TrackingFocusedElementForAllFrames \ | |
| 877 DISABLED_TrackingFocusedElementForAllFrames | |
| 878 #else | |
| 879 #define MAYBE_TrackingFocusedElementForAllFrames \ | |
| 880 TrackingFocusedElementForAllFrames | |
| 881 #endif | |
| 882 IN_PROC_BROWSER_TEST_F(SitePerProcessTextInputManagerTest, | 875 IN_PROC_BROWSER_TEST_F(SitePerProcessTextInputManagerTest, |
| 883 MAYBE_TrackingFocusedElementForAllFrames) { | 876 DISABLED_TrackingFocusedElementForAllFrames) { |
| 884 CreateIframePage("a(a, b(a))"); | 877 CreateIframePage("a(a, b(a))"); |
| 885 std::vector<content::RenderFrameHost*> frames{ | 878 std::vector<content::RenderFrameHost*> frames{ |
| 886 GetFrame(IndexVector{}), GetFrame(IndexVector{0}), | 879 GetFrame(IndexVector{}), GetFrame(IndexVector{0}), |
| 887 GetFrame(IndexVector{1}), GetFrame(IndexVector{1, 0})}; | 880 GetFrame(IndexVector{1}), GetFrame(IndexVector{1, 0})}; |
| 888 for (size_t i = 0; i < frames.size(); ++i) | 881 for (size_t i = 0; i < frames.size(); ++i) |
| 889 AddInputFieldToFrame(frames[i], "text", "some text", true); | 882 AddInputFieldToFrame(frames[i], "text", "some text", true); |
| 890 | 883 |
| 891 // Focus the <input> in |frame| and return if RenderFrameHost thinks there is | 884 // Focus the <input> in |frame| and return if RenderFrameHost thinks there is |
| 892 // a focused editable element in it. | 885 // a focused editable element in it. |
| 893 auto focus_input_and_return_editable_element_state = | 886 auto focus_input_and_return_editable_element_state = |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 set_input_focus(frame, false); | 948 set_input_focus(frame, false); |
| 956 EXPECT_FALSE(active_contents()->IsFocusedElementEditable()); | 949 EXPECT_FALSE(active_contents()->IsFocusedElementEditable()); |
| 957 } | 950 } |
| 958 } | 951 } |
| 959 | 952 |
| 960 // TODO(ekaramad): Could this become a unit test instead? | 953 // TODO(ekaramad): Could this become a unit test instead? |
| 961 // This test focuses <input> elements on the page and verifies that | 954 // This test focuses <input> elements on the page and verifies that |
| 962 // WebContents knows about the focused editable element. Then it asks the | 955 // WebContents knows about the focused editable element. Then it asks the |
| 963 // WebContents to clear focused element and verifies that there is no longer | 956 // WebContents to clear focused element and verifies that there is no longer |
| 964 // a focused editable element on the page. | 957 // a focused editable element on the page. |
| 958 // Test is flaky. crbug.com/705203 |
| 965 IN_PROC_BROWSER_TEST_F(SitePerProcessTextInputManagerTest, | 959 IN_PROC_BROWSER_TEST_F(SitePerProcessTextInputManagerTest, |
| 966 ClearFocusedElementOnPage) { | 960 DISABLED_ClearFocusedElementOnPage) { |
| 967 CreateIframePage("a(a, b(a))"); | 961 CreateIframePage("a(a, b(a))"); |
| 968 std::vector<content::RenderFrameHost*> frames{ | 962 std::vector<content::RenderFrameHost*> frames{ |
| 969 GetFrame(IndexVector{}), GetFrame(IndexVector{0}), | 963 GetFrame(IndexVector{}), GetFrame(IndexVector{0}), |
| 970 GetFrame(IndexVector{1}), GetFrame(IndexVector{1, 0})}; | 964 GetFrame(IndexVector{1}), GetFrame(IndexVector{1, 0})}; |
| 971 for (size_t i = 0; i < frames.size(); ++i) | 965 for (size_t i = 0; i < frames.size(); ++i) |
| 972 AddInputFieldToFrame(frames[i], "text", "some text", true); | 966 AddInputFieldToFrame(frames[i], "text", "some text", true); |
| 973 | 967 |
| 974 auto focus_frame_and_input = [](content::RenderFrameHost* frame) { | 968 auto focus_frame_and_input = [](content::RenderFrameHost* frame) { |
| 975 EXPECT_TRUE(ExecuteScript(frame, | 969 EXPECT_TRUE(ExecuteScript(frame, |
| 976 "window.focus();" | 970 "window.focus();" |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1371 | 1365 |
| 1372 // Closing this WebContents while we still hold on to our TestBrowserClient. | 1366 // Closing this WebContents while we still hold on to our TestBrowserClient. |
| 1373 EXPECT_TRUE(browser()->tab_strip_model()->CloseWebContentsAt( | 1367 EXPECT_TRUE(browser()->tab_strip_model()->CloseWebContentsAt( |
| 1374 1, TabStripModel::CLOSE_USER_GESTURE)); | 1368 1, TabStripModel::CLOSE_USER_GESTURE)); |
| 1375 | 1369 |
| 1376 // For the cleanup of the original WebContents in tab index 0. | 1370 // For the cleanup of the original WebContents in tab index 0. |
| 1377 content::SetBrowserClientForTesting(old_browser_client); | 1371 content::SetBrowserClientForTesting(old_browser_client); |
| 1378 } | 1372 } |
| 1379 #endif // defined(MAC_OSX) | 1373 #endif // defined(MAC_OSX) |
| 1380 #endif // !defined(OS_ANDROID) | 1374 #endif // !defined(OS_ANDROID) |
| OLD | NEW |