| 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/time.h" | 5 #include "base/time.h" |
| 6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "content/browser/renderer_host/render_view_host_impl.h" | 8 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 9 #include "content/browser/web_contents/web_contents_impl.h" | 9 #include "content/browser/web_contents/web_contents_impl.h" |
| 10 #include "content/common/view_messages.h" | 10 #include "content/common/view_messages.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 Value* element_value; | 162 Value* element_value; |
| 163 EXPECT_TRUE(list_value->Get(0, &element_value)); | 163 EXPECT_TRUE(list_value->Get(0, &element_value)); |
| 164 EXPECT_EQ(Value::TYPE_STRING, element_value->GetType()); | 164 EXPECT_EQ(Value::TYPE_STRING, element_value->GetType()); |
| 165 EXPECT_TRUE(list_value->Get(1, &element_value)); | 165 EXPECT_TRUE(list_value->Get(1, &element_value)); |
| 166 EXPECT_EQ(Value::TYPE_INTEGER, element_value->GetType()); | 166 EXPECT_EQ(Value::TYPE_INTEGER, element_value->GetType()); |
| 167 EXPECT_TRUE(list_value->Get(2, &element_value)); | 167 EXPECT_TRUE(list_value->Get(2, &element_value)); |
| 168 EXPECT_EQ(Value::TYPE_BOOLEAN, element_value->GetType()); | 168 EXPECT_EQ(Value::TYPE_BOOLEAN, element_value->GetType()); |
| 169 } | 169 } |
| 170 } | 170 } |
| 171 | 171 |
| 172 class RenderViewHostTestWebContentsObserver | 172 class RenderViewHostTestWebContentsObserver : public WebContentsObserver { |
| 173 : public content::WebContentsObserver { | |
| 174 public: | 173 public: |
| 175 explicit RenderViewHostTestWebContentsObserver(WebContents* web_contents) | 174 explicit RenderViewHostTestWebContentsObserver(WebContents* web_contents) |
| 176 : content::WebContentsObserver(web_contents), | 175 : WebContentsObserver(web_contents), |
| 177 navigation_count_(0) {} | 176 navigation_count_(0) {} |
| 178 virtual ~RenderViewHostTestWebContentsObserver() {} | 177 virtual ~RenderViewHostTestWebContentsObserver() {} |
| 179 | 178 |
| 180 virtual void DidNavigateMainFrame( | 179 virtual void DidNavigateMainFrame( |
| 181 const content::LoadCommittedDetails& details, | 180 const LoadCommittedDetails& details, |
| 182 const content::FrameNavigateParams& params) OVERRIDE { | 181 const FrameNavigateParams& params) OVERRIDE { |
| 183 observed_socket_address_ = params.socket_address; | 182 observed_socket_address_ = params.socket_address; |
| 184 base_url_ = params.base_url; | 183 base_url_ = params.base_url; |
| 185 ++navigation_count_; | 184 ++navigation_count_; |
| 186 } | 185 } |
| 187 | 186 |
| 188 const net::HostPortPair& observed_socket_address() const { | 187 const net::HostPortPair& observed_socket_address() const { |
| 189 return observed_socket_address_; | 188 return observed_socket_address_; |
| 190 } | 189 } |
| 191 | 190 |
| 192 GURL base_url() const { | 191 GURL base_url() const { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 EXPECT_EQ(1, observer.navigation_count()); | 225 EXPECT_EQ(1, observer.navigation_count()); |
| 227 | 226 |
| 228 // But should be set to the original page when reading MHTML. | 227 // But should be set to the original page when reading MHTML. |
| 229 test_url = net::FilePathToFileURL(test_server()->document_root().Append( | 228 test_url = net::FilePathToFileURL(test_server()->document_root().Append( |
| 230 FILE_PATH_LITERAL("google.mht"))); | 229 FILE_PATH_LITERAL("google.mht"))); |
| 231 NavigateToURL(shell(), test_url); | 230 NavigateToURL(shell(), test_url); |
| 232 EXPECT_EQ("http://www.google.com/", observer.base_url().spec()); | 231 EXPECT_EQ("http://www.google.com/", observer.base_url().spec()); |
| 233 } | 232 } |
| 234 | 233 |
| 235 } // namespace content | 234 } // namespace content |
| OLD | NEW |