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

Side by Side Diff: chrome/browser/ui/views/drag_and_drop_interactive_uitest.cc

Issue 2786223002: Fix flakiness in DragAndDropBrowserTests (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
OLDNEW
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 <algorithm> 5 #include <algorithm>
6 #include <initializer_list> 6 #include <initializer_list>
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 if (response != 42) 688 if (response != 42)
689 return false; 689 return false;
690 observer.Wait(); 690 observer.Wait();
691 691
692 // |frame| might have been swapped-out during a cross-site navigation, 692 // |frame| might have been swapped-out during a cross-site navigation,
693 // therefore we need to get the current RenderFrameHost to work against 693 // therefore we need to get the current RenderFrameHost to work against
694 // going forward. 694 // going forward.
695 frame = GetFrameByName(frame_name); 695 frame = GetFrameByName(frame_name);
696 DCHECK(frame); 696 DCHECK(frame);
697 697
698 // Wait until frame contents (e.g. images) have painted (which should happen 698 // Wait until frame contents have painted and are ready for hit testing.
699 // in the animation frame that *starts* after the onload event - therefore 699 WaitForChildFrameSurfaceReady(frame);
700 // we need to wait for 2 animation frames).
701 script = std::string(
702 "requestAnimationFrame(function() {\n"
703 " requestAnimationFrame(function() {\n"
704 " domAutomationController.send(43);\n"
705 " });\n"
706 "});\n");
707 if (!content::ExecuteScriptAndExtractInt(frame, script, &response))
708 return false;
709 if (response != 43)
710 return false;
711 700
712 return true; 701 return true;
713 } 702 }
714 703
715 content::RenderFrameHost* GetFrameByName(const std::string& name_to_find) { 704 content::RenderFrameHost* GetFrameByName(const std::string& name_to_find) {
716 content::RenderFrameHost* result = nullptr; 705 content::RenderFrameHost* result = nullptr;
717 for (content::RenderFrameHost* rfh : web_contents()->GetAllFrames()) { 706 for (content::RenderFrameHost* rfh : web_contents()->GetAllFrames()) {
718 if (rfh->GetFrameName() == name_to_find) { 707 if (rfh->GetFrameName() == name_to_find) {
719 if (result) { 708 if (result) {
720 ADD_FAILURE() << "More than one frame named " 709 ADD_FAILURE() << "More than one frame named "
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 location_inside_web_contents); 820 location_inside_web_contents);
832 EXPECT_EQ(ui::DragDropTypes::DRAG_COPY, operation); 821 EXPECT_EQ(ui::DragDropTypes::DRAG_COPY, operation);
833 } 822 }
834 823
835 // Try to leave everything in a clean state. 824 // Try to leave everything in a clean state.
836 SimulateMouseUp(); 825 SimulateMouseUp();
837 } 826 }
838 827
839 // There is no known way to execute test-controlled tasks during 828 // There is no known way to execute test-controlled tasks during
840 // a drag-and-drop loop run by Windows OS. 829 // a drag-and-drop loop run by Windows OS.
841 // Flaky on Linux. crbug.com/704603 830 #if defined(OS_WIN)
alexmos 2017/03/31 21:57:54 Since you're reenabling this, also reference this
kenrb 2017/04/03 17:28:29 Done.
842 #if defined(OS_WIN) || defined(OS_LINUX)
843 #define MAYBE_DragImageBetweenFrames DISABLED_DragImageBetweenFrames 831 #define MAYBE_DragImageBetweenFrames DISABLED_DragImageBetweenFrames
844 #else 832 #else
845 #define MAYBE_DragImageBetweenFrames DragImageBetweenFrames 833 #define MAYBE_DragImageBetweenFrames DragImageBetweenFrames
846 #endif 834 #endif
847 835
848 // Data that needs to be shared across multiple test steps below 836 // Data that needs to be shared across multiple test steps below
849 // (i.e. across DragImageBetweenFrames_Step2 and DragImageBetweenFrames_Step3). 837 // (i.e. across DragImageBetweenFrames_Step2 and DragImageBetweenFrames_Step3).
850 struct DragAndDropBrowserTest::DragImageBetweenFrames_TestState { 838 struct DragAndDropBrowserTest::DragImageBetweenFrames_TestState {
851 DOMDragEventVerifier expected_dom_event_data; 839 DOMDragEventVerifier expected_dom_event_data;
852 std::unique_ptr<DOMDragEventWaiter> dragstart_event_waiter; 840 std::unique_ptr<DOMDragEventWaiter> dragstart_event_waiter;
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 // of a drag operation, and cross-site drags should be allowed across a 1269 // of a drag operation, and cross-site drags should be allowed across a
1282 // navigation. 1270 // navigation.
1283 1271
1284 INSTANTIATE_TEST_CASE_P( 1272 INSTANTIATE_TEST_CASE_P(
1285 SameSiteSubframe, DragAndDropBrowserTest, ::testing::Values(false)); 1273 SameSiteSubframe, DragAndDropBrowserTest, ::testing::Values(false));
1286 1274
1287 INSTANTIATE_TEST_CASE_P( 1275 INSTANTIATE_TEST_CASE_P(
1288 CrossSiteSubframe, DragAndDropBrowserTest, ::testing::Values(true)); 1276 CrossSiteSubframe, DragAndDropBrowserTest, ::testing::Values(true));
1289 1277
1290 } // namespace chrome 1278 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698