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

Side by Side Diff: content/browser/find_request_manager_browsertest.cc

Issue 2528813002: Fix Self-Referencing OOPIF Infinite Loop (Closed)
Patch Set: add fix to find and renderframe tests Created 4 years 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "content/browser/web_contents/web_contents_impl.h" 7 #include "content/browser/web_contents/web_contents_impl.h"
8 #include "content/public/browser/notification_types.h" 8 #include "content/public/browser/notification_types.h"
9 #include "content/public/common/content_switches.h" 9 #include "content/public/common/content_switches.h"
10 #include "content/public/test/browser_test_utils.h" 10 #include "content/public/test/browser_test_utils.h"
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 private: 312 private:
313 // Helper function for LoadMultiFramePage. Loads child frames until the frame 313 // Helper function for LoadMultiFramePage. Loads child frames until the frame
314 // tree rooted at |root| is a full binary tree of height |height|. 314 // tree rooted at |root| is a full binary tree of height |height|.
315 void LoadMultiFramePageChildFrames(int height, 315 void LoadMultiFramePageChildFrames(int height,
316 bool cross_process, 316 bool cross_process,
317 FrameTreeNode* root) { 317 FrameTreeNode* root) {
318 if (height == 0) 318 if (height == 0)
319 return; 319 return;
320 320
321 std::string hostname = root->current_origin().host(); 321 std::string hostname = root->current_origin().host();
322 if (cross_process)
alexmos 2016/12/28 00:25:59 Can you explain why this change is needed? I reme
davidsac (gone - try alexmos) 2017/01/03 19:29:35 Sorry for the miscommunication. I sent a descript
alexmos 2017/01/03 22:12:05 Ah, yes, I missed your explanation in the initial
davidsac (gone - try alexmos) 2017/01/03 23:14:18 That is a good point. Let me know which approach
alexmos 2017/01/04 22:35:10 Let's go with option (2), since we've confirmed wi
davidsac (gone - try alexmos) 2017/01/06 00:44:57 Done.
323 hostname.insert(0, 1, 'a'); 322 hostname.insert(0, 1, 'a');
324 GURL url(embedded_test_server()->GetURL(hostname, 323 GURL url(embedded_test_server()->GetURL(
alexmos 2016/12/28 00:25:59 Please fix the indent in lines 322-336.
davidsac (gone - try alexmos) 2017/01/06 00:44:57 Done.
325 "/find_in_page_multi_frame.html")); 324 hostname, "/find_in_page_multi_frame.html"));
326 325
327 TestNavigationObserver observer(shell()->web_contents()); 326 TestNavigationObserver observer(shell()->web_contents());
328 327
329 FrameTreeNode* child = root->child_at(0); 328 FrameTreeNode* child = root->child_at(0);
330 NavigateFrameToURL(child, url); 329 NavigateFrameToURL(child, url);
331 EXPECT_TRUE(observer.last_navigation_succeeded()); 330 EXPECT_TRUE(observer.last_navigation_succeeded());
332 LoadMultiFramePageChildFrames(height - 1, cross_process, child); 331 LoadMultiFramePageChildFrames(height - 1, cross_process, child);
333 332
334 child = root->child_at(1); 333 child = root->child_at(1);
335 NavigateFrameToURL(child, url); 334 NavigateFrameToURL(child, url);
336 EXPECT_TRUE(observer.last_navigation_succeeded()); 335 EXPECT_TRUE(observer.last_navigation_succeeded());
337 LoadMultiFramePageChildFrames(height - 1, cross_process, child); 336 LoadMultiFramePageChildFrames(height - 1, cross_process, child);
338 } 337 }
339 338
340 TestWebContentsDelegate test_delegate_; 339 TestWebContentsDelegate test_delegate_;
341 WebContentsDelegate* normal_delegate_; 340 WebContentsDelegate* normal_delegate_;
342 341
343 // The ID of the last find request requested. 342 // The ID of the last find request requested.
344 int last_request_id_; 343 int last_request_id_;
345 344
346 DISALLOW_COPY_AND_ASSIGN(FindRequestManagerTest); 345 DISALLOW_COPY_AND_ASSIGN(FindRequestManagerTest);
347 }; 346 };
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 blink::WebFindOptions options; 565 blink::WebFindOptions options;
567 Find("result", options); 566 Find("result", options);
568 options.findNext = true; 567 options.findNext = true;
569 options.forward = false; 568 options.forward = false;
570 Find("result", options); 569 Find("result", options);
571 Find("result", options); 570 Find("result", options);
572 Find("result", options); 571 Find("result", options);
573 delegate()->WaitForFinalReply(); 572 delegate()->WaitForFinalReply();
574 573
575 FindResults results = delegate()->GetFindResults(); 574 FindResults results = delegate()->GetFindResults();
575
alexmos 2016/12/28 00:25:58 new blank line not needed
davidsac (gone - try alexmos) 2017/01/06 00:44:57 Done.
576 EXPECT_EQ(last_request_id(), results.request_id); 576 EXPECT_EQ(last_request_id(), results.request_id);
577 EXPECT_EQ(21, results.number_of_matches); 577 EXPECT_EQ(21, results.number_of_matches);
578 EXPECT_EQ(19, results.active_match_ordinal); 578 EXPECT_EQ(19, results.active_match_ordinal);
579 579
580 // Navigate one of the empty frames to a page with 5 matches. 580 // Navigate one of the empty frames to a page with 5 matches.
581 FrameTreeNode* root = 581 FrameTreeNode* root =
582 static_cast<WebContentsImpl*>(shell()->web_contents())-> 582 static_cast<WebContentsImpl*>(shell()->web_contents())->
583 GetFrameTree()->root(); 583 GetFrameTree()->root();
584 GURL url(embedded_test_server()->GetURL( 584 GURL url(embedded_test_server()->GetURL(
585 GetParam() ? "b.com" : "a.com", "/find_in_simple_page.html")); 585 GetParam() ? "b.com" : "a.com", "/find_in_simple_page.html"));
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 delegate()->MarkNextReply(); 813 delegate()->MarkNextReply();
814 contents()->ActivateNearestFindResult( 814 contents()->ActivateNearestFindResult(
815 rects[order[i]].CenterPoint().x(), rects[order[i]].CenterPoint().y()); 815 rects[order[i]].CenterPoint().x(), rects[order[i]].CenterPoint().y());
816 delegate()->WaitForNextReply(); 816 delegate()->WaitForNextReply();
817 EXPECT_EQ(order[i] + 1, delegate()->GetFindResults().active_match_ordinal); 817 EXPECT_EQ(order[i] + 1, delegate()->GetFindResults().active_match_ordinal);
818 } 818 }
819 } 819 }
820 #endif // defined(OS_ANDROID) 820 #endif // defined(OS_ANDROID)
821 821
822 } // namespace content 822 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698