| 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); |
| 87 DoNavigationTest(contents(), 1); | 88 DoNavigationTest(contents(), 1); |
| 88 | 89 |
| 89 // Test the case where we're not doing the initial navigation. This is | 90 // Test the case where we're not doing the initial navigation. This is |
| 90 // slightly different than the very-first-navigation case since the | 91 // slightly different than the very-first-navigation case since the |
| 91 // SiteInstance will be the same (the original TabContents must still be | 92 // SiteInstance will be the same (the original TabContents must still be |
| 92 // alive), which will trigger different behavior in RenderViewHostManager. | 93 // alive), which will trigger different behavior in RenderViewHostManager. |
| 93 TestTabContents contents2(profile_.get(), NULL); | 94 TestTabContents contents2(profile_.get(), NULL); |
| 94 | 95 |
| 95 DoNavigationTest(&contents2, 101); | 96 DoNavigationTest(&contents2, 101); |
| 96 } | 97 } |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 | 186 |
| 186 // Navigate forward. Shouldn't focus the location bar. | 187 // Navigate forward. Shouldn't focus the location bar. |
| 187 focus_called = tc->focus_called(); | 188 focus_called = tc->focus_called(); |
| 188 ASSERT_TRUE(controller().CanGoForward()); | 189 ASSERT_TRUE(controller().CanGoForward()); |
| 189 controller().GoForward(); | 190 controller().GoForward(); |
| 190 pending_rvh()->SendNavigate(next_page_id, next_url); | 191 pending_rvh()->SendNavigate(next_page_id, next_url); |
| 191 EXPECT_EQ(focus_called, tc->focus_called()); | 192 EXPECT_EQ(focus_called, tc->focus_called()); |
| 192 | 193 |
| 193 contents_.swap(tc_scoped_ptr); | 194 contents_.swap(tc_scoped_ptr); |
| 194 } | 195 } |
| OLD | NEW |