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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura_unittest.cc

Issue 2563783002: ui + mus: Split ContextFactory into ContextFactory(Client) and ContextFactoryPrivate (Closed)
Patch Set: Restore mash Created 4 years 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 "content/browser/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <tuple> 10 #include <tuple>
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 : widget_host_uses_shutdown_to_destroy_(false), 491 : widget_host_uses_shutdown_to_destroy_(false),
492 is_guest_view_hack_(false) {} 492 is_guest_view_hack_(false) {}
493 493
494 void SetUpEnvironment() { 494 void SetUpEnvironment() {
495 ImageTransportFactory::InitializeForUnitTests( 495 ImageTransportFactory::InitializeForUnitTests(
496 std::unique_ptr<ImageTransportFactory>( 496 std::unique_ptr<ImageTransportFactory>(
497 new NoTransportImageTransportFactory)); 497 new NoTransportImageTransportFactory));
498 aura_test_helper_.reset( 498 aura_test_helper_.reset(
499 new aura::test::AuraTestHelper(base::MessageLoopForUI::current())); 499 new aura::test::AuraTestHelper(base::MessageLoopForUI::current()));
500 aura_test_helper_->SetUp( 500 aura_test_helper_->SetUp(
501 ImageTransportFactory::GetInstance()->GetContextFactory()); 501 ImageTransportFactory::GetInstance()->GetContextFactory(),
502 ImageTransportFactory::GetInstance()->GetContextFactoryPrivate());
502 new wm::DefaultActivationClient(aura_test_helper_->root_window()); 503 new wm::DefaultActivationClient(aura_test_helper_->root_window());
503 504
504 browser_context_.reset(new TestBrowserContext); 505 browser_context_.reset(new TestBrowserContext);
505 process_host_ = new MockRenderProcessHost(browser_context_.get()); 506 process_host_ = new MockRenderProcessHost(browser_context_.get());
506 process_host_->Init(); 507 process_host_->Init();
507 508
508 sink_ = &process_host_->sink(); 509 sink_ = &process_host_->sink();
509 510
510 int32_t routing_id = process_host_->GetNextRoutingID(); 511 int32_t routing_id = process_host_->GetNextRoutingID();
511 delegates_.push_back(base::WrapUnique(new MockRenderWidgetHostDelegate)); 512 delegates_.push_back(base::WrapUnique(new MockRenderWidgetHostDelegate));
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1678 return frame; 1679 return frame;
1679 } 1680 }
1680 1681
1681 // If the ui::Compositor has been reset then resources are returned back to the 1682 // If the ui::Compositor has been reset then resources are returned back to the
1682 // client in response to the swap. This test verifies that the returned 1683 // client in response to the swap. This test verifies that the returned
1683 // resources are indeed reported as being in response to a swap. 1684 // resources are indeed reported as being in response to a swap.
1684 TEST_F(RenderWidgetHostViewAuraTest, ResettingCompositorReturnsResources) { 1685 TEST_F(RenderWidgetHostViewAuraTest, ResettingCompositorReturnsResources) {
1685 FakeSurfaceObserver manager_observer; 1686 FakeSurfaceObserver manager_observer;
1686 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 1687 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
1687 cc::SurfaceManager* manager = 1688 cc::SurfaceManager* manager =
1688 factory->GetContextFactory()->GetSurfaceManager(); 1689 factory->GetContextFactoryPrivate()->GetSurfaceManager();
1689 manager->AddObserver(&manager_observer); 1690 manager->AddObserver(&manager_observer);
1690 1691
1691 gfx::Size view_size(100, 100); 1692 gfx::Size view_size(100, 100);
1692 gfx::Rect view_rect(view_size); 1693 gfx::Rect view_rect(view_size);
1693 1694
1694 view_->InitAsChild(nullptr); 1695 view_->InitAsChild(nullptr);
1695 aura::client::ParentWindowWithContext( 1696 aura::client::ParentWindowWithContext(
1696 view_->GetNativeView(), parent_view_->GetNativeView()->GetRootWindow(), 1697 view_->GetNativeView(), parent_view_->GetNativeView()->GetRootWindow(),
1697 gfx::Rect()); 1698 gfx::Rect());
1698 view_->SetSize(view_size); 1699 view_->SetSize(view_size);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1746 EXPECT_FALSE(std::get<1>(params)); // is_swap_ack 1747 EXPECT_FALSE(std::get<1>(params)); // is_swap_ack
1747 } 1748 }
1748 } 1749 }
1749 1750
1750 // This test verifies that when the compositor_frame_sink_id changes, then 1751 // This test verifies that when the compositor_frame_sink_id changes, then
1751 // DelegateFrameHost returns compositor resources without a swap ack. 1752 // DelegateFrameHost returns compositor resources without a swap ack.
1752 TEST_F(RenderWidgetHostViewAuraTest, TwoOutputSurfaces) { 1753 TEST_F(RenderWidgetHostViewAuraTest, TwoOutputSurfaces) {
1753 FakeSurfaceObserver manager_observer; 1754 FakeSurfaceObserver manager_observer;
1754 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 1755 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
1755 cc::SurfaceManager* manager = 1756 cc::SurfaceManager* manager =
1756 factory->GetContextFactory()->GetSurfaceManager(); 1757 factory->GetContextFactoryPrivate()->GetSurfaceManager();
1757 manager->AddObserver(&manager_observer); 1758 manager->AddObserver(&manager_observer);
1758 1759
1759 gfx::Size view_size(100, 100); 1760 gfx::Size view_size(100, 100);
1760 gfx::Rect view_rect(view_size); 1761 gfx::Rect view_rect(view_size);
1761 1762
1762 view_->InitAsChild(nullptr); 1763 view_->InitAsChild(nullptr);
1763 aura::client::ParentWindowWithContext( 1764 aura::client::ParentWindowWithContext(
1764 view_->GetNativeView(), parent_view_->GetNativeView()->GetRootWindow(), 1765 view_->GetNativeView(), parent_view_->GetNativeView()->GetRootWindow(),
1765 gfx::Rect()); 1766 gfx::Rect());
1766 view_->SetSize(view_size); 1767 view_->SetSize(view_size);
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1912 1913
1913 view_->OnSwapCompositorFrame(0, 1914 view_->OnSwapCompositorFrame(0,
1914 MakeDelegatedFrame(1.f, view_size, view_rect)); 1915 MakeDelegatedFrame(1.f, view_size, view_rect));
1915 std::unique_ptr<ui::LayerTreeOwner> mirror(wm::MirrorLayers( 1916 std::unique_ptr<ui::LayerTreeOwner> mirror(wm::MirrorLayers(
1916 view_->GetNativeView(), false /* sync_bounds */)); 1917 view_->GetNativeView(), false /* sync_bounds */));
1917 1918
1918 cc::SurfaceId id = view_->GetDelegatedFrameHost()->SurfaceIdForTesting(); 1919 cc::SurfaceId id = view_->GetDelegatedFrameHost()->SurfaceIdForTesting();
1919 if (id.is_valid()) { 1920 if (id.is_valid()) {
1920 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 1921 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
1921 cc::SurfaceManager* manager = 1922 cc::SurfaceManager* manager =
1922 factory->GetContextFactory()->GetSurfaceManager(); 1923 factory->GetContextFactoryPrivate()->GetSurfaceManager();
1923 cc::Surface* surface = manager->GetSurfaceForId(id); 1924 cc::Surface* surface = manager->GetSurfaceForId(id);
1924 EXPECT_TRUE(surface); 1925 EXPECT_TRUE(surface);
1925 1926
1926 // An orphaned mirror should not be a destruction dependency. 1927 // An orphaned mirror should not be a destruction dependency.
1927 EXPECT_EQ(1u, surface->GetDestructionDependencyCount()); 1928 EXPECT_EQ(1u, surface->GetDestructionDependencyCount());
1928 1929
1929 // Both layers should be destruction dependencies. 1930 // Both layers should be destruction dependencies.
1930 root->layer()->Add(mirror->root()); 1931 root->layer()->Add(mirror->root());
1931 EXPECT_EQ(2u, surface->GetDestructionDependencyCount()); 1932 EXPECT_EQ(2u, surface->GetDestructionDependencyCount());
1932 root->layer()->Remove(mirror->root()); 1933 root->layer()->Remove(mirror->root());
(...skipping 2743 matching lines...) Expand 10 before | Expand all | Expand 10 after
4676 4677
4677 // Retrieve the selected text from clipboard and verify it is as expected. 4678 // Retrieve the selected text from clipboard and verify it is as expected.
4678 base::string16 result_text; 4679 base::string16 result_text;
4679 clipboard->ReadText(ui::CLIPBOARD_TYPE_SELECTION, &result_text); 4680 clipboard->ReadText(ui::CLIPBOARD_TYPE_SELECTION, &result_text);
4680 EXPECT_EQ(expected_text, result_text); 4681 EXPECT_EQ(expected_text, result_text);
4681 } 4682 }
4682 } 4683 }
4683 #endif 4684 #endif
4684 4685
4685 } // namespace content 4686 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.cc ('k') | content/public/browser/context_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698