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

Side by Side Diff: content/public/test/browser_test_utils.cc

Issue 2849603005: Do not reinvent the wheel / use content APIs to find a frame by name. (Closed)
Patch Set: s/DCHECK_EQ/EXPECT_EQ/g 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
« no previous file with comments | « content/browser/webui/web_ui_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/public/test/browser_test_utils.h" 5 #include "content/public/test/browser_test_utils.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <tuple> 8 #include <tuple>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 frame_set->insert(host); 928 frame_set->insert(host);
929 } 929 }
930 } 930 }
931 931
932 RenderFrameHost* FrameMatchingPredicate( 932 RenderFrameHost* FrameMatchingPredicate(
933 WebContents* web_contents, 933 WebContents* web_contents,
934 const base::Callback<bool(RenderFrameHost*)>& predicate) { 934 const base::Callback<bool(RenderFrameHost*)>& predicate) {
935 std::set<RenderFrameHost*> frame_set; 935 std::set<RenderFrameHost*> frame_set;
936 web_contents->ForEachFrame( 936 web_contents->ForEachFrame(
937 base::Bind(&AddToSetIfFrameMatchesPredicate, &frame_set, predicate)); 937 base::Bind(&AddToSetIfFrameMatchesPredicate, &frame_set, predicate));
938 DCHECK_EQ(1U, frame_set.size()); 938 EXPECT_EQ(1U, frame_set.size());
sky 2017/05/01 21:14:09 One comment here. This should really be an ASSERT.
Łukasz Anforowicz 2017/05/01 21:42:31 Good catch - I should have been more careful about
sky 2017/05/01 23:33:33 How about changing the return to: return frame_set
Łukasz Anforowicz 2017/05/02 19:55:48 Done.
939 return *frame_set.begin(); 939 return *frame_set.begin();
940 } 940 }
941 941
942 bool FrameMatchesName(const std::string& name, RenderFrameHost* frame) { 942 bool FrameMatchesName(const std::string& name, RenderFrameHost* frame) {
943 return frame->GetFrameName() == name; 943 return frame->GetFrameName() == name;
944 } 944 }
945 945
946 bool FrameIsChildOfMainFrame(RenderFrameHost* frame) { 946 bool FrameIsChildOfMainFrame(RenderFrameHost* frame) {
947 return frame->GetParent() && !frame->GetParent()->GetParent(); 947 return frame->GetParent() && !frame->GetParent()->GetParent();
948 } 948 }
(...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after
2031 bool user_gesture, 2031 bool user_gesture,
2032 bool last_unlocked_by_target, 2032 bool last_unlocked_by_target,
2033 bool privileged) { 2033 bool privileged) {
2034 IPC::IpcSecurityTestUtil::PwnMessageReceived( 2034 IPC::IpcSecurityTestUtil::PwnMessageReceived(
2035 process->GetChannel(), 2035 process->GetChannel(),
2036 ViewHostMsg_LockMouse(routing_id, user_gesture, last_unlocked_by_target, 2036 ViewHostMsg_LockMouse(routing_id, user_gesture, last_unlocked_by_target,
2037 privileged)); 2037 privileged));
2038 } 2038 }
2039 2039
2040 } // namespace content 2040 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/webui/web_ui_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698