| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/dom_ui/new_tab_ui.h" | 5 #include "chrome/browser/dom_ui/new_tab_ui.h" |
| 6 #include "chrome/browser/renderer_host/test_render_view_host.h" | 6 #include "chrome/browser/renderer_host/test_render_view_host.h" |
| 7 #include "chrome/common/url_constants.h" | 7 #include "chrome/common/url_constants.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 class DOMUITest : public RenderViewHostTestHarness { | 10 class DOMUITest : public RenderViewHostTestHarness { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 // Tests that the New Tab Page flags are correctly set and propogated by | 81 // Tests that the New Tab Page flags are correctly set and propogated by |
| 82 // WebContents when we first navigate to a DOM UI page, then to a standard | 82 // WebContents when we first navigate to a DOM UI page, then to a standard |
| 83 // non-DOM-UI page. | 83 // non-DOM-UI page. |
| 84 TEST_F(DOMUITest, DOMUIToStandard) { | 84 TEST_F(DOMUITest, DOMUIToStandard) { |
| 85 DoNavigationTest(contents(), 1); | 85 DoNavigationTest(contents(), 1); |
| 86 | 86 |
| 87 // Test the case where we're not doing the initial navigation. This is | 87 // Test the case where we're not doing the initial navigation. This is |
| 88 // slightly different than the very-first-navigation case since the | 88 // slightly different than the very-first-navigation case since the |
| 89 // SiteInstance will be the same (the original WebContents must still be | 89 // SiteInstance will be the same (the original WebContents must still be |
| 90 // alive), which will trigger different behavior in RenderViewHostManager. | 90 // alive), which will trigger different behavior in RenderViewHostManager. |
| 91 WebContents* contents2 = new TestWebContents(profile_.get(), NULL, | 91 WebContents* contents2 = new TestWebContents(profile_.get(), NULL); |
| 92 &rvh_factory_); | |
| 93 NavigationController* controller2 = | 92 NavigationController* controller2 = |
| 94 new NavigationController(contents2, profile_.get()); | 93 new NavigationController(contents2, profile_.get()); |
| 95 contents2->set_controller(controller2); | 94 contents2->set_controller(controller2); |
| 96 | 95 |
| 97 DoNavigationTest(contents2, 101); | 96 DoNavigationTest(contents2, 101); |
| 98 contents2->CloseContents(); | 97 contents2->CloseContents(); |
| 99 } | 98 } |
| 100 | 99 |
| 101 TEST_F(DOMUITest, DOMUIToDOMUI) { | 100 TEST_F(DOMUITest, DOMUIToDOMUI) { |
| 102 // Do a load (this state is tested above). | 101 // Do a load (this state is tested above). |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 // Start a pending load for a DOMUI. | 135 // Start a pending load for a DOMUI. |
| 137 GURL new_tab_url(chrome::kChromeUINewTabURL); | 136 GURL new_tab_url(chrome::kChromeUINewTabURL); |
| 138 controller()->LoadURL(new_tab_url, GURL(), PageTransition::LINK); | 137 controller()->LoadURL(new_tab_url, GURL(), PageTransition::LINK); |
| 139 EXPECT_FALSE(contents()->ShouldDisplayURL()); | 138 EXPECT_FALSE(contents()->ShouldDisplayURL()); |
| 140 EXPECT_TRUE(contents()->ShouldDisplayFavIcon()); | 139 EXPECT_TRUE(contents()->ShouldDisplayFavIcon()); |
| 141 EXPECT_FALSE(contents()->IsBookmarkBarAlwaysVisible()); | 140 EXPECT_FALSE(contents()->IsBookmarkBarAlwaysVisible()); |
| 142 EXPECT_TRUE(contents()->FocusLocationBarByDefault()); | 141 EXPECT_TRUE(contents()->FocusLocationBarByDefault()); |
| 143 | 142 |
| 144 // Committing DOM UI is tested above. | 143 // Committing DOM UI is tested above. |
| 145 } | 144 } |
| OLD | NEW |