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

Side by Side Diff: content/browser/web_contents/web_contents_impl_browsertest.cc

Issue 196283013: Make to call WebContentsImpl::RenderViewCreated() when we create child window. (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/values.h" 5 #include "base/values.h"
6 #include "content/browser/frame_host/navigation_entry_impl.h" 6 #include "content/browser/frame_host/navigation_entry_impl.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/load_notification_details.h" 8 #include "content/public/browser/load_notification_details.h"
9 #include "content/public/browser/navigation_controller.h" 9 #include "content/public/browser/navigation_controller.h"
10 #include "content/public/browser/notification_details.h" 10 #include "content/public/browser/notification_details.h"
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 // Install the observer and navigate cross-site. 378 // Install the observer and navigate cross-site.
379 RenderFrameCreatedObserver observer(shell()); 379 RenderFrameCreatedObserver observer(shell());
380 NavigateToURL(shell(), cross_site_url); 380 NavigateToURL(shell(), cross_site_url);
381 381
382 // The observer should've seen a RenderFrameCreated call for the new frame 382 // The observer should've seen a RenderFrameCreated call for the new frame
383 // and not the old one. 383 // and not the old one.
384 EXPECT_NE(observer.last_rfh(), orig_rfh); 384 EXPECT_NE(observer.last_rfh(), orig_rfh);
385 EXPECT_EQ(observer.last_rfh(), shell()->web_contents()->GetMainFrame()); 385 EXPECT_EQ(observer.last_rfh(), shell()->web_contents()->GetMainFrame());
386 } 386 }
387 387
388 IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
389 RenderViewCreatedForChildWindow) {
390 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
391
392 NavigateToURL(shell(),
393 embedded_test_server()->GetURL("/title1.html"));
394
395 WebContentsAddedObserver new_web_contents_observer;
396 ASSERT_TRUE(ExecuteScript(shell()->web_contents(),
397 "var a = document.createElement('a');"
398 "a.href='./title2.html';"
399 "a.target = '_blank';"
400 "document.body.appendChild(a);"
401 "a.click();"));
402 WebContents* new_web_contents = new_web_contents_observer.GetWebContents();
403 WaitForLoadStop(new_web_contents);
404 EXPECT_TRUE(new_web_contents_observer.RenderViewCreatedCalled());
405 }
406
388 } // namespace content 407 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698