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

Side by Side Diff: media/mojo/clients/mojo_android_overlay_unittest.cc

Issue 2796943002: Move routing token out of AndroidOverlay config. (Closed)
Patch Set: cl feedback 1/2 Created 3 years, 8 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
« no previous file with comments | « media/mojo/clients/mojo_android_overlay_factory.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 <memory> 5 #include <memory>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 class MojoAndroidOverlayTest : public ::testing::Test { 90 class MojoAndroidOverlayTest : public ::testing::Test {
91 public: 91 public:
92 MojoAndroidOverlayTest() 92 MojoAndroidOverlayTest()
93 : overlay_binding_(&mock_overlay_), interface_provider_(mock_provider_) {} 93 : overlay_binding_(&mock_overlay_), interface_provider_(mock_provider_) {}
94 94
95 ~MojoAndroidOverlayTest() override {} 95 ~MojoAndroidOverlayTest() override {}
96 96
97 void SetUp() override { 97 void SetUp() override {
98 // Set up default config. 98 // Set up default config.
99 config_.routing_token = base::UnguessableToken::Create();
100 config_.rect = gfx::Rect(100, 200, 300, 400); 99 config_.rect = gfx::Rect(100, 200, 300, 400);
101 config_.ready_cb = base::Bind(&MockClientCallbacks::OnReady, 100 config_.ready_cb = base::Bind(&MockClientCallbacks::OnReady,
102 base::Unretained(&callbacks_)); 101 base::Unretained(&callbacks_));
103 config_.failed_cb = base::Bind(&MockClientCallbacks::OnFailed, 102 config_.failed_cb = base::Bind(&MockClientCallbacks::OnFailed,
104 base::Unretained(&callbacks_)); 103 base::Unretained(&callbacks_));
105 config_.destroyed_cb = base::Bind(&MockClientCallbacks::OnDestroyed, 104 config_.destroyed_cb = base::Bind(&MockClientCallbacks::OnDestroyed,
106 base::Unretained(&callbacks_)); 105 base::Unretained(&callbacks_));
107 } 106 }
108 107
109 void TearDown() override { 108 void TearDown() override {
110 overlay_client_.reset(); 109 overlay_client_.reset();
111 base::RunLoop().RunUntilIdle(); 110 base::RunLoop().RunUntilIdle();
112 } 111 }
113 112
114 // Create an overlay in |overlay_client_| using the current config, but do 113 // Create an overlay in |overlay_client_| using the current config, but do
115 // not bind anything to |overlay_request_| yet. 114 // not bind anything to |overlay_request_| yet.
116 void CreateOverlay() { 115 void CreateOverlay() {
117 EXPECT_CALL(interface_provider_, 116 EXPECT_CALL(interface_provider_,
118 InterfaceGotten(mojom::AndroidOverlayProvider::Name_)) 117 InterfaceGotten(mojom::AndroidOverlayProvider::Name_))
119 .Times(1); 118 .Times(1);
120 EXPECT_CALL(mock_provider_, OverlayCreated()); 119 EXPECT_CALL(mock_provider_, OverlayCreated());
121 120
121 base::UnguessableToken routing_token = base::UnguessableToken::Create();
122 overlay_client_.reset( 122 overlay_client_.reset(
123 new MojoAndroidOverlay(&interface_provider_, config_)); 123 new MojoAndroidOverlay(&interface_provider_, config_, routing_token));
124 base::RunLoop().RunUntilIdle(); 124 base::RunLoop().RunUntilIdle();
125 } 125 }
126 126
127 // Create an overlay, then provide it with |mock_overlay_|. 127 // Create an overlay, then provide it with |mock_overlay_|.
128 void CreateAndInitializeOverlay() { 128 void CreateAndInitializeOverlay() {
129 CreateOverlay(); 129 CreateOverlay();
130 130
131 // Bind an overlay to the request. 131 // Bind an overlay to the request.
132 overlay_binding_.Bind(std::move(mock_provider_.overlay_request_)); 132 overlay_binding_.Bind(std::move(mock_provider_.overlay_request_));
133 base::RunLoop().RunUntilIdle(); 133 base::RunLoop().RunUntilIdle();
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 // Test that layouts are ignored before the client is notified about a surface. 206 // Test that layouts are ignored before the client is notified about a surface.
207 TEST_F(MojoAndroidOverlayTest, LayoutBeforeSurfaceIsIgnored) { 207 TEST_F(MojoAndroidOverlayTest, LayoutBeforeSurfaceIsIgnored) {
208 CreateAndInitializeOverlay(); 208 CreateAndInitializeOverlay();
209 209
210 gfx::Rect new_layout(5, 6, 7, 8); 210 gfx::Rect new_layout(5, 6, 7, 8);
211 EXPECT_CALL(mock_overlay_, ScheduleLayout(_)).Times(0); 211 EXPECT_CALL(mock_overlay_, ScheduleLayout(_)).Times(0);
212 overlay_client_->ScheduleLayout(new_layout); 212 overlay_client_->ScheduleLayout(new_layout);
213 } 213 }
214 214
215 } // namespace media 215 } // namespace media
OLDNEW
« no previous file with comments | « media/mojo/clients/mojo_android_overlay_factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698