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/macros.h" | 5 #include "base/macros.h" |
6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 #include "content/browser/frame_host/navigation_handle_impl.h" |
11 #include "content/browser/frame_host/render_frame_host_impl.h" | 12 #include "content/browser/frame_host/render_frame_host_impl.h" |
12 #include "content/browser/renderer_host/render_view_host_impl.h" | 13 #include "content/browser/renderer_host/render_view_host_impl.h" |
13 #include "content/browser/web_contents/web_contents_impl.h" | 14 #include "content/browser/web_contents/web_contents_impl.h" |
14 #include "content/common/view_messages.h" | 15 #include "content/common/view_messages.h" |
15 #include "content/public/browser/notification_types.h" | 16 #include "content/public/browser/notification_types.h" |
16 #include "content/public/browser/web_contents_observer.h" | 17 #include "content/public/browser/web_contents_observer.h" |
17 #include "content/public/common/content_paths.h" | 18 #include "content/public/common/content_paths.h" |
18 #include "content/public/common/frame_navigate_params.h" | 19 #include "content/public/common/frame_navigate_params.h" |
19 #include "content/public/test/browser_test_utils.h" | 20 #include "content/public/test/browser_test_utils.h" |
20 #include "content/public/test/content_browser_test.h" | 21 #include "content/public/test/content_browser_test.h" |
(...skipping 10 matching lines...) Expand all Loading... |
31 RenderViewHostTest() {} | 32 RenderViewHostTest() {} |
32 }; | 33 }; |
33 | 34 |
34 class RenderViewHostTestWebContentsObserver : public WebContentsObserver { | 35 class RenderViewHostTestWebContentsObserver : public WebContentsObserver { |
35 public: | 36 public: |
36 explicit RenderViewHostTestWebContentsObserver(WebContents* web_contents) | 37 explicit RenderViewHostTestWebContentsObserver(WebContents* web_contents) |
37 : WebContentsObserver(web_contents), | 38 : WebContentsObserver(web_contents), |
38 navigation_count_(0) {} | 39 navigation_count_(0) {} |
39 ~RenderViewHostTestWebContentsObserver() override {} | 40 ~RenderViewHostTestWebContentsObserver() override {} |
40 | 41 |
41 void DidNavigateMainFrame(const LoadCommittedDetails& details, | 42 void DidFinishNavigation(NavigationHandle* navigation_handle) override { |
42 const FrameNavigateParams& params) override { | 43 if (!navigation_handle->IsInMainFrame() || |
43 observed_socket_address_ = params.socket_address; | 44 !navigation_handle->HasCommitted()) { |
44 base_url_ = params.base_url; | 45 return; |
| 46 } |
| 47 |
| 48 NavigationHandleImpl* impl = |
| 49 static_cast<NavigationHandleImpl*>(navigation_handle); |
| 50 observed_socket_address_ = navigation_handle->GetSocketAddress(); |
| 51 base_url_ = impl->base_url(); |
45 ++navigation_count_; | 52 ++navigation_count_; |
46 } | 53 } |
47 | 54 |
48 const net::HostPortPair& observed_socket_address() const { | 55 const net::HostPortPair& observed_socket_address() const { |
49 return observed_socket_address_; | 56 return observed_socket_address_; |
50 } | 57 } |
51 | 58 |
52 GURL base_url() const { | 59 GURL base_url() const { |
53 return base_url_; | 60 return base_url_; |
54 } | 61 } |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 165 |
159 // Do something that causes ipc queues to flush and tasks in | 166 // Do something that causes ipc queues to flush and tasks in |
160 // flight to complete such that we should have received the ACK. | 167 // flight to complete such that we should have received the ACK. |
161 NavigateToURL(shell(), test_url); | 168 NavigateToURL(shell(), test_url); |
162 | 169 |
163 // Verify we have the only remaining reference to the namespace. | 170 // Verify we have the only remaining reference to the namespace. |
164 EXPECT_TRUE(session_namespace->HasOneRef()); | 171 EXPECT_TRUE(session_namespace->HasOneRef()); |
165 } | 172 } |
166 | 173 |
167 } // namespace content | 174 } // namespace content |
OLD | NEW |