Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1117)

Side by Side Diff: content/browser/web_contents/web_contents_impl_unittest.cc

Issue 1413643002: Separate RenderViewHost from RenderWidgetHost, part 2: public implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2675 matching lines...) Expand 10 before | Expand all | Expand 10 after
2686 contents()->DecrementCapturerCount(); 2686 contents()->DecrementCapturerCount();
2687 EXPECT_EQ(0, contents()->GetCapturerCount()); 2687 EXPECT_EQ(0, contents()->GetCapturerCount());
2688 EXPECT_EQ(original_preferred_size, contents()->GetPreferredSize()); 2688 EXPECT_EQ(original_preferred_size, contents()->GetPreferredSize());
2689 } 2689 }
2690 2690
2691 TEST_F(WebContentsImplTest, CapturerPreventsHiding) { 2691 TEST_F(WebContentsImplTest, CapturerPreventsHiding) {
2692 const gfx::Size original_preferred_size(1024, 768); 2692 const gfx::Size original_preferred_size(1024, 768);
2693 contents()->UpdatePreferredSize(original_preferred_size); 2693 contents()->UpdatePreferredSize(original_preferred_size);
2694 2694
2695 TestRenderWidgetHostView* view = static_cast<TestRenderWidgetHostView*>( 2695 TestRenderWidgetHostView* view = static_cast<TestRenderWidgetHostView*>(
2696 contents()->GetMainFrame()->GetRenderViewHost()->GetView()); 2696 contents()->GetMainFrame()->GetRenderViewHost()->GetWidget()->GetView());
2697 2697
2698 // With no capturers, setting and un-setting occlusion should change the 2698 // With no capturers, setting and un-setting occlusion should change the
2699 // view's occlusion state. 2699 // view's occlusion state.
2700 EXPECT_FALSE(view->is_showing()); 2700 EXPECT_FALSE(view->is_showing());
2701 contents()->WasShown(); 2701 contents()->WasShown();
2702 EXPECT_TRUE(view->is_showing()); 2702 EXPECT_TRUE(view->is_showing());
2703 contents()->WasHidden(); 2703 contents()->WasHidden();
2704 EXPECT_FALSE(view->is_showing()); 2704 EXPECT_FALSE(view->is_showing());
2705 contents()->WasShown(); 2705 contents()->WasShown();
2706 EXPECT_TRUE(view->is_showing()); 2706 EXPECT_TRUE(view->is_showing());
2707 2707
2708 // Add a capturer and try to hide the contents. The view will remain visible. 2708 // Add a capturer and try to hide the contents. The view will remain visible.
2709 contents()->IncrementCapturerCount(gfx::Size()); 2709 contents()->IncrementCapturerCount(gfx::Size());
2710 contents()->WasHidden(); 2710 contents()->WasHidden();
2711 EXPECT_TRUE(view->is_showing()); 2711 EXPECT_TRUE(view->is_showing());
2712 2712
2713 // Remove the capturer, and the WasHidden should take effect. 2713 // Remove the capturer, and the WasHidden should take effect.
2714 contents()->DecrementCapturerCount(); 2714 contents()->DecrementCapturerCount();
2715 EXPECT_FALSE(view->is_showing()); 2715 EXPECT_FALSE(view->is_showing());
2716 } 2716 }
2717 2717
2718 TEST_F(WebContentsImplTest, CapturerPreventsOcclusion) { 2718 TEST_F(WebContentsImplTest, CapturerPreventsOcclusion) {
2719 const gfx::Size original_preferred_size(1024, 768); 2719 const gfx::Size original_preferred_size(1024, 768);
2720 contents()->UpdatePreferredSize(original_preferred_size); 2720 contents()->UpdatePreferredSize(original_preferred_size);
2721 2721
2722 TestRenderWidgetHostView* view = static_cast<TestRenderWidgetHostView*>( 2722 TestRenderWidgetHostView* view = static_cast<TestRenderWidgetHostView*>(
2723 contents()->GetMainFrame()->GetRenderViewHost()->GetView()); 2723 contents()->GetMainFrame()->GetRenderViewHost()->GetWidget()->GetView());
2724 2724
2725 // With no capturers, setting and un-setting occlusion should change the 2725 // With no capturers, setting and un-setting occlusion should change the
2726 // view's occlusion state. 2726 // view's occlusion state.
2727 EXPECT_FALSE(view->is_occluded()); 2727 EXPECT_FALSE(view->is_occluded());
2728 contents()->WasOccluded(); 2728 contents()->WasOccluded();
2729 EXPECT_TRUE(view->is_occluded()); 2729 EXPECT_TRUE(view->is_occluded());
2730 contents()->WasUnOccluded(); 2730 contents()->WasUnOccluded();
2731 EXPECT_FALSE(view->is_occluded()); 2731 EXPECT_FALSE(view->is_occluded());
2732 contents()->WasOccluded(); 2732 contents()->WasOccluded();
2733 EXPECT_TRUE(view->is_occluded()); 2733 EXPECT_TRUE(view->is_occluded());
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
3376 backend->AllowCertForHost(*cert, test_url.host(), 1); 3376 backend->AllowCertForHost(*cert, test_url.host(), 1);
3377 EXPECT_TRUE(backend->HasAllowException(test_url.host())); 3377 EXPECT_TRUE(backend->HasAllowException(test_url.host()));
3378 3378
3379 contents()->OnDidLoadResourceFromMemoryCache(test_url, "", "GET", "mime type", 3379 contents()->OnDidLoadResourceFromMemoryCache(test_url, "", "GET", "mime type",
3380 RESOURCE_TYPE_MAIN_FRAME); 3380 RESOURCE_TYPE_MAIN_FRAME);
3381 3381
3382 EXPECT_TRUE(backend->HasAllowException(test_url.host())); 3382 EXPECT_TRUE(backend->HasAllowException(test_url.host()));
3383 } 3383 }
3384 3384
3385 } // namespace content 3385 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | content/browser/web_contents/web_contents_view_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698