OLD | NEW |
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/strings/utf_string_conversions.h" | 5 #include "base/strings/utf_string_conversions.h" |
6 #include "base/values.h" | 6 #include "base/values.h" |
7 #include "content/browser/frame_host/navigation_entry_impl.h" | 7 #include "content/browser/frame_host/navigation_entry_impl.h" |
8 #include "content/browser/web_contents/web_contents_impl.h" | 8 #include "content/browser/web_contents/web_contents_impl.h" |
9 #include "content/browser/web_contents/web_contents_view.h" | 9 #include "content/browser/web_contents/web_contents_view.h" |
10 #include "content/common/frame_messages.h" | 10 #include "content/common/frame_messages.h" |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 private: | 395 private: |
396 RenderFrameHost* last_rfh_; | 396 RenderFrameHost* last_rfh_; |
397 | 397 |
398 DISALLOW_COPY_AND_ASSIGN(RenderFrameCreatedObserver); | 398 DISALLOW_COPY_AND_ASSIGN(RenderFrameCreatedObserver); |
399 }; | 399 }; |
400 | 400 |
401 // Test that creation of new RenderFrameHost objects sends the correct object | 401 // Test that creation of new RenderFrameHost objects sends the correct object |
402 // to the WebContentObservers. See http://crbug.com/347339. | 402 // to the WebContentObservers. See http://crbug.com/347339. |
403 IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, | 403 IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, |
404 RenderFrameCreatedCorrectProcessForObservers) { | 404 RenderFrameCreatedCorrectProcessForObservers) { |
405 std::string foo_com("foo.com"); | 405 static const char kFooCom[] = "foo.com"; |
406 GURL::Replacements replace_host; | 406 GURL::Replacements replace_host; |
407 net::HostPortPair foo_host_port; | 407 net::HostPortPair foo_host_port; |
408 GURL cross_site_url; | 408 GURL cross_site_url; |
409 | 409 |
410 // Setup the server to allow serving separate sites, so we can perform | 410 // Setup the server to allow serving separate sites, so we can perform |
411 // cross-process navigation. | 411 // cross-process navigation. |
412 host_resolver()->AddRule("*", "127.0.0.1"); | 412 host_resolver()->AddRule("*", "127.0.0.1"); |
413 ASSERT_TRUE(test_server()->Start()); | 413 ASSERT_TRUE(test_server()->Start()); |
414 | 414 |
415 foo_host_port = test_server()->host_port_pair(); | 415 foo_host_port = test_server()->host_port_pair(); |
416 foo_host_port.set_host(foo_com); | 416 foo_host_port.set_host(kFooCom); |
417 | 417 |
418 GURL initial_url(test_server()->GetURL("/title1.html")); | 418 GURL initial_url(test_server()->GetURL("/title1.html")); |
419 | 419 |
420 cross_site_url = test_server()->GetURL("/title2.html"); | 420 cross_site_url = test_server()->GetURL("/title2.html"); |
421 replace_host.SetHostStr(foo_com); | 421 replace_host.SetHostStr(kFooCom); |
422 cross_site_url = cross_site_url.ReplaceComponents(replace_host); | 422 cross_site_url = cross_site_url.ReplaceComponents(replace_host); |
423 | 423 |
424 // Navigate to the initial URL and capture the RenderFrameHost for later | 424 // Navigate to the initial URL and capture the RenderFrameHost for later |
425 // comparison. | 425 // comparison. |
426 NavigateToURL(shell(), initial_url); | 426 NavigateToURL(shell(), initial_url); |
427 RenderFrameHost* orig_rfh = shell()->web_contents()->GetMainFrame(); | 427 RenderFrameHost* orig_rfh = shell()->web_contents()->GetMainFrame(); |
428 | 428 |
429 // Install the observer and navigate cross-site. | 429 // Install the observer and navigate cross-site. |
430 RenderFrameCreatedObserver observer(shell()); | 430 RenderFrameCreatedObserver observer(shell()); |
431 NavigateToURL(shell(), cross_site_url); | 431 NavigateToURL(shell(), cross_site_url); |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 new FirstVisuallyNonEmptyPaintObserver(shell())); | 636 new FirstVisuallyNonEmptyPaintObserver(shell())); |
637 | 637 |
638 NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html")); | 638 NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html")); |
639 | 639 |
640 observer->WaitForDidFirstVisuallyNonEmptyPaint(); | 640 observer->WaitForDidFirstVisuallyNonEmptyPaint(); |
641 ASSERT_TRUE(observer->did_fist_visually_non_empty_paint_); | 641 ASSERT_TRUE(observer->did_fist_visually_non_empty_paint_); |
642 } | 642 } |
643 | 643 |
644 } // namespace content | 644 } // namespace content |
645 | 645 |
OLD | NEW |