Chromium Code Reviews| 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 <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 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 695 frame = GetFrameByName(frame_name); | 695 frame = GetFrameByName(frame_name); |
| 696 DCHECK(frame); | 696 DCHECK(frame); |
| 697 | 697 |
| 698 // Wait until frame contents have painted and are ready for hit testing. | 698 // Wait until frame contents have painted and are ready for hit testing. |
| 699 WaitForChildFrameSurfaceReady(frame); | 699 WaitForChildFrameSurfaceReady(frame); |
| 700 | 700 |
| 701 return true; | 701 return true; |
| 702 } | 702 } |
| 703 | 703 |
| 704 content::RenderFrameHost* GetFrameByName(const std::string& name_to_find) { | 704 content::RenderFrameHost* GetFrameByName(const std::string& name_to_find) { |
| 705 content::RenderFrameHost* result = nullptr; | 705 return content::FrameMatchingPredicate( |
| 706 for (content::RenderFrameHost* rfh : web_contents()->GetAllFrames()) { | 706 web_contents(), base::Bind(&content::FrameMatchesName, name_to_find)); |
|
ncarter (slow)
2017/04/27 22:03:42
You've removed some ADD_FAILURES here, but I don't
Łukasz Anforowicz
2017/04/27 22:59:28
Yes - I think replacing gtest asserts with a DCHEC
| |
| 707 if (rfh->GetFrameName() == name_to_find) { | |
| 708 if (result) { | |
| 709 ADD_FAILURE() << "More than one frame named " | |
| 710 << "'" << name_to_find << "'"; | |
| 711 return nullptr; | |
| 712 } | |
| 713 result = rfh; | |
| 714 } | |
| 715 } | |
| 716 | |
| 717 EXPECT_TRUE(result) << "Couldn't find a frame named " | |
| 718 << "'" << name_to_find << "'"; | |
| 719 return result; | |
| 720 } | 707 } |
| 721 | 708 |
| 722 void AssertTestPageIsLoaded() { | 709 void AssertTestPageIsLoaded() { |
| 723 ASSERT_EQ(kTestPagePath, web_contents()->GetLastCommittedURL().path()); | 710 ASSERT_EQ(kTestPagePath, web_contents()->GetLastCommittedURL().path()); |
| 724 } | 711 } |
| 725 | 712 |
| 726 std::unique_ptr<DragAndDropSimulator> drag_simulator_; | 713 std::unique_ptr<DragAndDropSimulator> drag_simulator_; |
| 727 | 714 |
| 728 DISALLOW_COPY_AND_ASSIGN(DragAndDropBrowserTest); | 715 DISALLOW_COPY_AND_ASSIGN(DragAndDropBrowserTest); |
| 729 }; | 716 }; |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1269 // of a drag operation, and cross-site drags should be allowed across a | 1256 // of a drag operation, and cross-site drags should be allowed across a |
| 1270 // navigation. | 1257 // navigation. |
| 1271 | 1258 |
| 1272 INSTANTIATE_TEST_CASE_P( | 1259 INSTANTIATE_TEST_CASE_P( |
| 1273 SameSiteSubframe, DragAndDropBrowserTest, ::testing::Values(false)); | 1260 SameSiteSubframe, DragAndDropBrowserTest, ::testing::Values(false)); |
| 1274 | 1261 |
| 1275 INSTANTIATE_TEST_CASE_P( | 1262 INSTANTIATE_TEST_CASE_P( |
| 1276 CrossSiteSubframe, DragAndDropBrowserTest, ::testing::Values(true)); | 1263 CrossSiteSubframe, DragAndDropBrowserTest, ::testing::Values(true)); |
| 1277 | 1264 |
| 1278 } // namespace chrome | 1265 } // namespace chrome |
| OLD | NEW |