OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/test_render_view_host.h" | 6 #include "chrome/browser/renderer_host/test/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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 private: | 77 private: |
78 ChromeThread ui_thread_; | 78 ChromeThread ui_thread_; |
79 | 79 |
80 DISALLOW_COPY_AND_ASSIGN(DOMUITest); | 80 DISALLOW_COPY_AND_ASSIGN(DOMUITest); |
81 }; | 81 }; |
82 | 82 |
83 // Tests that the New Tab Page flags are correctly set and propogated by | 83 // Tests that the New Tab Page flags are correctly set and propogated by |
84 // TabContents when we first navigate to a DOM UI page, then to a standard | 84 // TabContents when we first navigate to a DOM UI page, then to a standard |
85 // non-DOM-UI page. | 85 // non-DOM-UI page. |
86 TEST_F(DOMUITest, DOMUIToStandard) { | 86 TEST_F(DOMUITest, DOMUIToStandard) { |
87 profile_->CreateBookmarkModel(true); | |
88 DoNavigationTest(contents(), 1); | 87 DoNavigationTest(contents(), 1); |
89 | 88 |
90 // Test the case where we're not doing the initial navigation. This is | 89 // Test the case where we're not doing the initial navigation. This is |
91 // slightly different than the very-first-navigation case since the | 90 // slightly different than the very-first-navigation case since the |
92 // SiteInstance will be the same (the original TabContents must still be | 91 // SiteInstance will be the same (the original TabContents must still be |
93 // alive), which will trigger different behavior in RenderViewHostManager. | 92 // alive), which will trigger different behavior in RenderViewHostManager. |
94 TestTabContents contents2(profile_.get(), NULL); | 93 TestTabContents contents2(profile_.get(), NULL); |
95 | 94 |
96 DoNavigationTest(&contents2, 101); | 95 DoNavigationTest(&contents2, 101); |
97 } | 96 } |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 185 |
187 // Navigate forward. Shouldn't focus the location bar. | 186 // Navigate forward. Shouldn't focus the location bar. |
188 focus_called = tc->focus_called(); | 187 focus_called = tc->focus_called(); |
189 ASSERT_TRUE(controller().CanGoForward()); | 188 ASSERT_TRUE(controller().CanGoForward()); |
190 controller().GoForward(); | 189 controller().GoForward(); |
191 pending_rvh()->SendNavigate(next_page_id, next_url); | 190 pending_rvh()->SendNavigate(next_page_id, next_url); |
192 EXPECT_EQ(focus_called, tc->focus_called()); | 191 EXPECT_EQ(focus_called, tc->focus_called()); |
193 | 192 |
194 contents_.swap(tc_scoped_ptr); | 193 contents_.swap(tc_scoped_ptr); |
195 } | 194 } |
OLD | NEW |