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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 tracker->ListenFor(NOTIFICATION_NAV_ENTRY_CHANGED, | 149 tracker->ListenFor(NOTIFICATION_NAV_ENTRY_CHANGED, |
150 Source<NavigationController>(controller)); | 150 Source<NavigationController>(controller)); |
151 } | 151 } |
152 | 152 |
153 SiteInstance* GetSiteInstanceFromEntry(NavigationEntry* entry) { | 153 SiteInstance* GetSiteInstanceFromEntry(NavigationEntry* entry) { |
154 return NavigationEntryImpl::FromNavigationEntry(entry)->site_instance(); | 154 return NavigationEntryImpl::FromNavigationEntry(entry)->site_instance(); |
155 } | 155 } |
156 | 156 |
157 class TestWebContentsDelegate : public WebContentsDelegate { | 157 class TestWebContentsDelegate : public WebContentsDelegate { |
158 public: | 158 public: |
159 explicit TestWebContentsDelegate() : | 159 TestWebContentsDelegate() : |
160 navigation_state_change_count_(0) {} | 160 navigation_state_change_count_(0) {} |
161 | 161 |
162 int navigation_state_change_count() { | 162 int navigation_state_change_count() { |
163 return navigation_state_change_count_; | 163 return navigation_state_change_count_; |
164 } | 164 } |
165 | 165 |
166 // Keep track of whether the tab has notified us of a navigation state change. | 166 // Keep track of whether the tab has notified us of a navigation state change. |
167 virtual void NavigationStateChanged(const WebContents* source, | 167 virtual void NavigationStateChanged(const WebContents* source, |
168 unsigned changed_flags) { | 168 unsigned changed_flags) { |
169 navigation_state_change_count_++; | 169 navigation_state_change_count_++; |
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 EXPECT_EQ(controller.GetLastCommittedEntryIndex(), 1); | 937 EXPECT_EQ(controller.GetLastCommittedEntryIndex(), 1); |
938 EXPECT_EQ(controller.GetPendingEntryIndex(), -1); | 938 EXPECT_EQ(controller.GetPendingEntryIndex(), -1); |
939 EXPECT_TRUE(controller.GetLastCommittedEntry()); | 939 EXPECT_TRUE(controller.GetLastCommittedEntry()); |
940 EXPECT_FALSE(controller.GetPendingEntry()); | 940 EXPECT_FALSE(controller.GetPendingEntry()); |
941 EXPECT_TRUE(controller.CanGoBack()); | 941 EXPECT_TRUE(controller.CanGoBack()); |
942 EXPECT_FALSE(controller.CanGoForward()); | 942 EXPECT_FALSE(controller.CanGoForward()); |
943 } | 943 } |
944 | 944 |
945 class TestNavigationObserver : public RenderViewHostObserver { | 945 class TestNavigationObserver : public RenderViewHostObserver { |
946 public: | 946 public: |
947 TestNavigationObserver(RenderViewHost* render_view_host) | 947 explicit TestNavigationObserver(RenderViewHost* render_view_host) |
948 : RenderViewHostObserver(render_view_host) { | 948 : RenderViewHostObserver(render_view_host) { |
949 } | 949 } |
950 | 950 |
951 const GURL& navigated_url() const { | 951 const GURL& navigated_url() const { |
952 return navigated_url_; | 952 return navigated_url_; |
953 } | 953 } |
954 | 954 |
955 protected: | 955 protected: |
956 virtual void Navigate(const GURL& url) OVERRIDE { | 956 virtual void Navigate(const GURL& url) OVERRIDE { |
957 navigated_url_ = url; | 957 navigated_url_ = url; |
(...skipping 2232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3190 PAGE_TRANSITION_LINK); | 3190 PAGE_TRANSITION_LINK); |
3191 session_helper_.AssertNavigationEquals(nav, | 3191 session_helper_.AssertNavigationEquals(nav, |
3192 windows_[0]->tabs[0]->navigations[0]); | 3192 windows_[0]->tabs[0]->navigations[0]); |
3193 nav.set_url(url2); | 3193 nav.set_url(url2); |
3194 session_helper_.AssertNavigationEquals(nav, | 3194 session_helper_.AssertNavigationEquals(nav, |
3195 windows_[0]->tabs[0]->navigations[1]); | 3195 windows_[0]->tabs[0]->navigations[1]); |
3196 } | 3196 } |
3197 */ | 3197 */ |
3198 | 3198 |
3199 } // namespace content | 3199 } // namespace content |
OLD | NEW |