| 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 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1479 browser()->tab_strip_model()->GetActiveWebContents(), | 1479 browser()->tab_strip_model()->GetActiveWebContents(), |
| 1480 "window.open('" + webui_url.spec() + "');")); | 1480 "window.open('" + webui_url.spec() + "');")); |
| 1481 windowed_observer.Wait(); | 1481 windowed_observer.Wait(); |
| 1482 content::NavigationController* controller = | 1482 content::NavigationController* controller = |
| 1483 content::Source<content::NavigationController>(windowed_observer.source()) | 1483 content::Source<content::NavigationController>(windowed_observer.source()) |
| 1484 .ptr(); | 1484 .ptr(); |
| 1485 content::WebContents* popup = controller->GetWebContents(); | 1485 content::WebContents* popup = controller->GetWebContents(); |
| 1486 ASSERT_TRUE(popup); | 1486 ASSERT_TRUE(popup); |
| 1487 EXPECT_EQ(2, browser()->tab_strip_model()->count()); | 1487 EXPECT_EQ(2, browser()->tab_strip_model()->count()); |
| 1488 content::RenderViewHost* webui_rvh = popup->GetRenderViewHost(); | 1488 content::RenderViewHost* webui_rvh = popup->GetRenderViewHost(); |
| 1489 EXPECT_EQ(content::BINDINGS_POLICY_WEB_UI, webui_rvh->GetEnabledBindings()); | 1489 content::RenderFrameHost* webui_rfh = popup->GetMainFrame(); |
| 1490 EXPECT_EQ(content::BINDINGS_POLICY_WEB_UI, webui_rfh->GetEnabledBindings()); |
| 1490 | 1491 |
| 1491 // Navigate to another page in the popup. | 1492 // Navigate to another page in the popup. |
| 1492 GURL nonwebui_url(embedded_test_server()->GetURL("a.com", "/title1.html")); | 1493 GURL nonwebui_url(embedded_test_server()->GetURL("a.com", "/title1.html")); |
| 1493 ui_test_utils::NavigateToURL(browser(), nonwebui_url); | 1494 ui_test_utils::NavigateToURL(browser(), nonwebui_url); |
| 1494 EXPECT_NE(webui_rvh, popup->GetRenderViewHost()); | 1495 EXPECT_NE(webui_rvh, popup->GetRenderViewHost()); |
| 1495 | 1496 |
| 1496 // Go back in the popup. This should finish without crashing and should | 1497 // Go back in the popup. This should finish without crashing and should |
| 1497 // reuse the old RenderViewHost. | 1498 // reuse the old RenderViewHost. |
| 1498 content::TestNavigationObserver back_load_observer(popup); | 1499 content::TestNavigationObserver back_load_observer(popup); |
| 1499 controller->GoBack(); | 1500 controller->GoBack(); |
| 1500 back_load_observer.Wait(); | 1501 back_load_observer.Wait(); |
| 1501 EXPECT_EQ(webui_rvh, popup->GetRenderViewHost()); | 1502 EXPECT_EQ(webui_rvh, popup->GetRenderViewHost()); |
| 1502 EXPECT_TRUE(webui_rvh->IsRenderViewLive()); | 1503 EXPECT_TRUE(webui_rvh->IsRenderViewLive()); |
| 1503 EXPECT_EQ(content::BINDINGS_POLICY_WEB_UI, webui_rvh->GetEnabledBindings()); | 1504 EXPECT_EQ(content::BINDINGS_POLICY_WEB_UI, |
| 1505 webui_rvh->GetMainFrame()->GetEnabledBindings()); |
| 1504 } | 1506 } |
| 1505 | 1507 |
| 1506 } // namespace | 1508 } // namespace |
| OLD | NEW |