| 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/logging.h" | 6 #include "base/logging.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "content/browser/frame_host/cross_site_transferring_request.h" | 8 #include "content/browser/frame_host/cross_site_transferring_request.h" |
| 9 #include "content/browser/frame_host/interstitial_page_impl.h" | 9 #include "content/browser/frame_host/interstitial_page_impl.h" |
| 10 #include "content/browser/frame_host/navigation_entry_impl.h" | 10 #include "content/browser/frame_host/navigation_entry_impl.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 } | 250 } |
| 251 ~TestWebContentsObserver() override {} | 251 ~TestWebContentsObserver() override {} |
| 252 | 252 |
| 253 void DidFinishLoad(RenderFrameHost* render_frame_host, | 253 void DidFinishLoad(RenderFrameHost* render_frame_host, |
| 254 const GURL& validated_url) override { | 254 const GURL& validated_url) override { |
| 255 last_url_ = validated_url; | 255 last_url_ = validated_url; |
| 256 } | 256 } |
| 257 void DidFailLoad(RenderFrameHost* render_frame_host, | 257 void DidFailLoad(RenderFrameHost* render_frame_host, |
| 258 const GURL& validated_url, | 258 const GURL& validated_url, |
| 259 int error_code, | 259 int error_code, |
| 260 const base::string16& error_description) override { | 260 const base::string16& error_description, |
| 261 bool was_ignored_by_handler) override { |
| 261 last_url_ = validated_url; | 262 last_url_ = validated_url; |
| 262 } | 263 } |
| 263 | 264 |
| 264 void DidChangeThemeColor(SkColor theme_color) override { | 265 void DidChangeThemeColor(SkColor theme_color) override { |
| 265 last_theme_color_ = theme_color; | 266 last_theme_color_ = theme_color; |
| 266 } | 267 } |
| 267 | 268 |
| 268 const GURL& last_url() const { return last_url_; } | 269 const GURL& last_url() const { return last_url_; } |
| 269 SkColor last_theme_color() const { return last_theme_color_; } | 270 SkColor last_theme_color() const { return last_theme_color_; } |
| 270 | 271 |
| (...skipping 2180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2451 EXPECT_EQ(url_normalized, observer.last_url()); | 2452 EXPECT_EQ(url_normalized, observer.last_url()); |
| 2452 | 2453 |
| 2453 // Create and navigate another WebContents. | 2454 // Create and navigate another WebContents. |
| 2454 scoped_ptr<TestWebContents> other_contents( | 2455 scoped_ptr<TestWebContents> other_contents( |
| 2455 static_cast<TestWebContents*>(CreateTestWebContents())); | 2456 static_cast<TestWebContents*>(CreateTestWebContents())); |
| 2456 TestWebContentsObserver other_observer(other_contents.get()); | 2457 TestWebContentsObserver other_observer(other_contents.get()); |
| 2457 other_contents->NavigateAndCommit(url_normalized); | 2458 other_contents->NavigateAndCommit(url_normalized); |
| 2458 | 2459 |
| 2459 // Check that an IPC with about:whatever is correctly normalized. | 2460 // Check that an IPC with about:whatever is correctly normalized. |
| 2460 other_contents->TestDidFailLoadWithError( | 2461 other_contents->TestDidFailLoadWithError( |
| 2461 url_from_ipc, 1, base::string16()); | 2462 url_from_ipc, 1, base::string16(), false); |
| 2462 EXPECT_EQ(url_normalized, other_observer.last_url()); | 2463 EXPECT_EQ(url_normalized, other_observer.last_url()); |
| 2463 } | 2464 } |
| 2464 | 2465 |
| 2465 // Test that if a pending contents is deleted before it is shown, we don't | 2466 // Test that if a pending contents is deleted before it is shown, we don't |
| 2466 // crash. | 2467 // crash. |
| 2467 TEST_F(WebContentsImplTest, PendingContents) { | 2468 TEST_F(WebContentsImplTest, PendingContents) { |
| 2468 scoped_ptr<TestWebContents> other_contents( | 2469 scoped_ptr<TestWebContents> other_contents( |
| 2469 static_cast<TestWebContents*>(CreateTestWebContents())); | 2470 static_cast<TestWebContents*>(CreateTestWebContents())); |
| 2470 contents()->AddPendingContents(other_contents.get()); | 2471 contents()->AddPendingContents(other_contents.get()); |
| 2471 int route_id = other_contents->GetRenderViewHost()->GetRoutingID(); | 2472 int route_id = other_contents->GetRenderViewHost()->GetRoutingID(); |
| (...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3163 // Additional changes made by the web contents should propagate as well. | 3164 // Additional changes made by the web contents should propagate as well. |
| 3164 RenderViewHostTester::TestOnMessageReceived( | 3165 RenderViewHostTester::TestOnMessageReceived( |
| 3165 test_rvh(), | 3166 test_rvh(), |
| 3166 FrameHostMsg_DidChangeThemeColor(rfh->GetRoutingID(), SK_ColorGREEN)); | 3167 FrameHostMsg_DidChangeThemeColor(rfh->GetRoutingID(), SK_ColorGREEN)); |
| 3167 | 3168 |
| 3168 EXPECT_EQ(SK_ColorGREEN, contents()->GetThemeColor()); | 3169 EXPECT_EQ(SK_ColorGREEN, contents()->GetThemeColor()); |
| 3169 EXPECT_EQ(SK_ColorGREEN, observer.last_theme_color()); | 3170 EXPECT_EQ(SK_ColorGREEN, observer.last_theme_color()); |
| 3170 } | 3171 } |
| 3171 | 3172 |
| 3172 } // namespace content | 3173 } // namespace content |
| OLD | NEW |