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

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

Issue 2849603005: Do not reinvent the wheel / use content APIs to find a frame by name. (Closed)
Patch Set: Reverting changes in content_subresource_filter_driver_factory_unittest.cc Created 3 years, 7 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 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
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));
707 if (rfh->GetFrameName() == name_to_find) {
708 if (result) {
709 ADD_FAILURE() << "More than one frame named "
710 << "'" << name_to_find << "'";
Łukasz Anforowicz 2017/04/28 22:52:09 This ADD_FAILURE will be replaced by a DCHECK from
sky 2017/05/01 16:50:30 Remember that a DCHECK in tests causes a crash. Wo
Łukasz Anforowicz 2017/05/01 18:11:29 Done. Thanks for raising this point again - I pre
711 return nullptr;
712 }
713 result = rfh;
714 }
715 }
716
717 EXPECT_TRUE(result) << "Couldn't find a frame named "
718 << "'" << name_to_find << "'";
Łukasz Anforowicz 2017/04/28 22:52:09 This EXPECT_TRUE will be replaced by a DCHECK from
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
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
OLDNEW
« no previous file with comments | « chrome/browser/subresource_filter/subresource_filter_browsertest.cc ('k') | content/browser/webui/web_ui_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698