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

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

Issue 2661543002: Rename LocalFrameId to LocalSurfaceId (Closed)
Patch Set: c Created 3 years, 10 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) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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/compositor/test/no_transport_image_transport_factory.h " 5 #include "content/browser/compositor/test/no_transport_image_transport_factory.h "
6 #include "content/browser/renderer_host/offscreen_canvas_surface_impl.h" 6 #include "content/browser/renderer_host/offscreen_canvas_surface_impl.h"
7 #include "content/browser/renderer_host/offscreen_canvas_surface_manager.h" 7 #include "content/browser/renderer_host/offscreen_canvas_surface_manager.h"
8 #include "content/public/test/test_browser_thread.h" 8 #include "content/public/test/test_browser_thread.h"
9 #include "mojo/public/cpp/bindings/binding.h" 9 #include "mojo/public/cpp/bindings/binding.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 #endif 65 #endif
66 } 66 }
67 67
68 // This test mimics the workflow of OffscreenCanvas.commit() on renderer 68 // This test mimics the workflow of OffscreenCanvas.commit() on renderer
69 // process. 69 // process.
70 TEST_F(OffscreenCanvasSurfaceManagerTest, 70 TEST_F(OffscreenCanvasSurfaceManagerTest,
71 SingleHTMLCanvasElementTransferToOffscreen) { 71 SingleHTMLCanvasElementTransferToOffscreen) {
72 blink::mojom::OffscreenCanvasSurfaceClientPtr client; 72 blink::mojom::OffscreenCanvasSurfaceClientPtr client;
73 cc::FrameSinkId frame_sink_id(3, 3); 73 cc::FrameSinkId frame_sink_id(3, 3);
74 cc::SurfaceIdAllocator surface_id_allocator; 74 cc::SurfaceIdAllocator surface_id_allocator;
75 cc::LocalFrameId current_local_frame_id(surface_id_allocator.GenerateId()); 75 cc::LocalSurfaceId current_local_surface_id(
76 surface_id_allocator.GenerateId());
76 77
77 auto surface_impl = base::WrapUnique( 78 auto surface_impl = base::WrapUnique(
78 new OffscreenCanvasSurfaceImpl(frame_sink_id, std::move(client))); 79 new OffscreenCanvasSurfaceImpl(frame_sink_id, std::move(client)));
79 EXPECT_EQ(1, this->getNumSurfaceImplInstances()); 80 EXPECT_EQ(1, this->getNumSurfaceImplInstances());
80 EXPECT_EQ(surface_impl.get(), 81 EXPECT_EQ(surface_impl.get(),
81 OffscreenCanvasSurfaceManager::GetInstance()->GetSurfaceInstance( 82 OffscreenCanvasSurfaceManager::GetInstance()->GetSurfaceInstance(
82 frame_sink_id)); 83 frame_sink_id));
83 84
84 this->OnSurfaceCreated(cc::SurfaceId(frame_sink_id, current_local_frame_id)); 85 this->OnSurfaceCreated(
85 EXPECT_EQ(current_local_frame_id, surface_impl->current_local_frame_id()); 86 cc::SurfaceId(frame_sink_id, current_local_surface_id));
87 EXPECT_EQ(current_local_surface_id, surface_impl->current_local_surface_id());
86 88
87 surface_impl = nullptr; 89 surface_impl = nullptr;
88 EXPECT_EQ(0, this->getNumSurfaceImplInstances()); 90 EXPECT_EQ(0, this->getNumSurfaceImplInstances());
89 } 91 }
90 92
91 TEST_F(OffscreenCanvasSurfaceManagerTest, 93 TEST_F(OffscreenCanvasSurfaceManagerTest,
92 MultiHTMLCanvasElementTransferToOffscreen) { 94 MultiHTMLCanvasElementTransferToOffscreen) {
93 blink::mojom::OffscreenCanvasSurfaceClientPtr client_a; 95 blink::mojom::OffscreenCanvasSurfaceClientPtr client_a;
94 cc::FrameSinkId frame_sink_id_a(3, 3); 96 cc::FrameSinkId frame_sink_id_a(3, 3);
95 cc::SurfaceIdAllocator surface_id_allocator; 97 cc::SurfaceIdAllocator surface_id_allocator;
(...skipping 14 matching lines...) Expand all
110 OffscreenCanvasSurfaceManager::GetInstance()->GetSurfaceInstance( 112 OffscreenCanvasSurfaceManager::GetInstance()->GetSurfaceInstance(
111 frame_sink_id_b)); 113 frame_sink_id_b));
112 114
113 surface_impl_a = nullptr; 115 surface_impl_a = nullptr;
114 EXPECT_EQ(1, this->getNumSurfaceImplInstances()); 116 EXPECT_EQ(1, this->getNumSurfaceImplInstances());
115 surface_impl_b = nullptr; 117 surface_impl_b = nullptr;
116 EXPECT_EQ(0, this->getNumSurfaceImplInstances()); 118 EXPECT_EQ(0, this->getNumSurfaceImplInstances());
117 } 119 }
118 120
119 } // namespace content 121 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698