| 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 3281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3292 test_rvh(), | 3292 test_rvh(), |
| 3293 FrameHostMsg_DidChangeThemeColor(rfh->GetRoutingID(), SK_ColorRED)); | 3293 FrameHostMsg_DidChangeThemeColor(rfh->GetRoutingID(), SK_ColorRED)); |
| 3294 | 3294 |
| 3295 EXPECT_EQ(SK_ColorRED, contents()->GetThemeColor()); | 3295 EXPECT_EQ(SK_ColorRED, contents()->GetThemeColor()); |
| 3296 EXPECT_EQ(transparent, observer.last_theme_color()); | 3296 EXPECT_EQ(transparent, observer.last_theme_color()); |
| 3297 | 3297 |
| 3298 // Simulate that the first visually non-empty paint has occurred. This will | 3298 // Simulate that the first visually non-empty paint has occurred. This will |
| 3299 // propagate the current theme color to the delegates. | 3299 // propagate the current theme color to the delegates. |
| 3300 RenderViewHostTester::TestOnMessageReceived( | 3300 RenderViewHostTester::TestOnMessageReceived( |
| 3301 test_rvh(), | 3301 test_rvh(), |
| 3302 FrameHostMsg_DidFirstVisuallyNonEmptyPaint(rfh->GetRoutingID())); | 3302 ViewHostMsg_DidFirstVisuallyNonEmptyPaint(rfh->GetRoutingID())); |
| 3303 | 3303 |
| 3304 EXPECT_EQ(SK_ColorRED, contents()->GetThemeColor()); | 3304 EXPECT_EQ(SK_ColorRED, contents()->GetThemeColor()); |
| 3305 EXPECT_EQ(SK_ColorRED, observer.last_theme_color()); | 3305 EXPECT_EQ(SK_ColorRED, observer.last_theme_color()); |
| 3306 | 3306 |
| 3307 // Additional changes made by the web contents should propagate as well. | 3307 // Additional changes made by the web contents should propagate as well. |
| 3308 RenderViewHostTester::TestOnMessageReceived( | 3308 RenderViewHostTester::TestOnMessageReceived( |
| 3309 test_rvh(), | 3309 test_rvh(), |
| 3310 FrameHostMsg_DidChangeThemeColor(rfh->GetRoutingID(), SK_ColorGREEN)); | 3310 FrameHostMsg_DidChangeThemeColor(rfh->GetRoutingID(), SK_ColorGREEN)); |
| 3311 | 3311 |
| 3312 EXPECT_EQ(SK_ColorGREEN, contents()->GetThemeColor()); | 3312 EXPECT_EQ(SK_ColorGREEN, contents()->GetThemeColor()); |
| 3313 EXPECT_EQ(SK_ColorGREEN, observer.last_theme_color()); | 3313 EXPECT_EQ(SK_ColorGREEN, observer.last_theme_color()); |
| 3314 } | 3314 } |
| 3315 | 3315 |
| 3316 // Test that if a renderer reports that it has loaded a resource from | 3316 // Test that if a renderer reports that it has loaded a resource from |
| 3317 // memory cache with bad security info (i.e. can't be deserialized), the | 3317 // memory cache with bad security info (i.e. can't be deserialized), the |
| 3318 // renderer gets killed. | 3318 // renderer gets killed. |
| 3319 TEST_F(WebContentsImplTest, LoadResourceFromMemoryCacheWithBadSecurityInfo) { | 3319 TEST_F(WebContentsImplTest, LoadResourceFromMemoryCacheWithBadSecurityInfo) { |
| 3320 MockRenderProcessHost* rph = contents()->GetMainFrame()->GetProcess(); | 3320 MockRenderProcessHost* rph = contents()->GetMainFrame()->GetProcess(); |
| 3321 EXPECT_EQ(0, rph->bad_msg_count()); | 3321 EXPECT_EQ(0, rph->bad_msg_count()); |
| 3322 | 3322 |
| 3323 contents()->OnDidLoadResourceFromMemoryCache( | 3323 contents()->OnDidLoadResourceFromMemoryCache( |
| 3324 GURL("http://example.test"), "not valid security info", "GET", | 3324 GURL("http://example.test"), "not valid security info", "GET", |
| 3325 "mime type", RESOURCE_TYPE_MAIN_FRAME); | 3325 "mime type", RESOURCE_TYPE_MAIN_FRAME); |
| 3326 EXPECT_EQ(1, rph->bad_msg_count()); | 3326 EXPECT_EQ(1, rph->bad_msg_count()); |
| 3327 } | 3327 } |
| 3328 | 3328 |
| 3329 } // namespace content | 3329 } // namespace content |
| OLD | NEW |