| OLD | NEW |
| 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 "chrome/browser/ui/browser_navigator_browsertest.h" | 5 #include "chrome/browser/ui/browser_navigator_browsertest.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 1462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1473 browser()->tab_strip_model()->GetActiveWebContents(), | 1473 browser()->tab_strip_model()->GetActiveWebContents(), |
| 1474 "window.open('" + webui_url.spec() + "');")); | 1474 "window.open('" + webui_url.spec() + "');")); |
| 1475 windowed_observer.Wait(); | 1475 windowed_observer.Wait(); |
| 1476 content::NavigationController* controller = | 1476 content::NavigationController* controller = |
| 1477 content::Source<content::NavigationController>(windowed_observer.source()) | 1477 content::Source<content::NavigationController>(windowed_observer.source()) |
| 1478 .ptr(); | 1478 .ptr(); |
| 1479 content::WebContents* popup = controller->GetWebContents(); | 1479 content::WebContents* popup = controller->GetWebContents(); |
| 1480 ASSERT_TRUE(popup); | 1480 ASSERT_TRUE(popup); |
| 1481 EXPECT_EQ(2, browser()->tab_strip_model()->count()); | 1481 EXPECT_EQ(2, browser()->tab_strip_model()->count()); |
| 1482 content::RenderViewHost* webui_rvh = popup->GetRenderViewHost(); | 1482 content::RenderViewHost* webui_rvh = popup->GetRenderViewHost(); |
| 1483 EXPECT_EQ(content::BINDINGS_POLICY_WEB_UI, webui_rvh->GetEnabledBindings()); | 1483 content::RenderFrameHost* webui_rfh = popup->GetMainFrame(); |
| 1484 EXPECT_EQ(content::BINDINGS_POLICY_WEB_UI, webui_rfh->GetEnabledBindings()); |
| 1484 | 1485 |
| 1485 // Navigate to another page in the popup. | 1486 // Navigate to another page in the popup. |
| 1486 GURL nonwebui_url(embedded_test_server()->GetURL("a.com", "/title1.html")); | 1487 GURL nonwebui_url(embedded_test_server()->GetURL("a.com", "/title1.html")); |
| 1487 ui_test_utils::NavigateToURL(browser(), nonwebui_url); | 1488 ui_test_utils::NavigateToURL(browser(), nonwebui_url); |
| 1488 EXPECT_NE(webui_rvh, popup->GetRenderViewHost()); | 1489 EXPECT_NE(webui_rvh, popup->GetRenderViewHost()); |
| 1489 | 1490 |
| 1490 // Go back in the popup. This should finish without crashing and should | 1491 // Go back in the popup. This should finish without crashing and should |
| 1491 // reuse the old RenderViewHost. | 1492 // reuse the old RenderViewHost. |
| 1492 content::TestNavigationObserver back_load_observer(popup); | 1493 content::TestNavigationObserver back_load_observer(popup); |
| 1493 controller->GoBack(); | 1494 controller->GoBack(); |
| 1494 back_load_observer.Wait(); | 1495 back_load_observer.Wait(); |
| 1495 EXPECT_EQ(webui_rvh, popup->GetRenderViewHost()); | 1496 EXPECT_EQ(webui_rvh, popup->GetRenderViewHost()); |
| 1496 EXPECT_TRUE(webui_rvh->IsRenderViewLive()); | 1497 EXPECT_TRUE(webui_rvh->IsRenderViewLive()); |
| 1497 EXPECT_EQ(content::BINDINGS_POLICY_WEB_UI, webui_rvh->GetEnabledBindings()); | 1498 EXPECT_EQ(content::BINDINGS_POLICY_WEB_UI, |
| 1499 webui_rvh->GetMainFrame()->GetEnabledBindings()); |
| 1498 } | 1500 } |
| 1499 | 1501 |
| 1500 } // namespace | 1502 } // namespace |
| OLD | NEW |