OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/bind.h" | 5 #include "base/bind.h" |
6 #include "components/exo/buffer.h" | 6 #include "components/exo/buffer.h" |
7 #include "components/exo/surface.h" | 7 #include "components/exo/surface.h" |
8 #include "components/exo/test/exo_test_base.h" | 8 #include "components/exo/test/exo_test_base.h" |
9 #include "components/exo/test/exo_test_helper.h" | 9 #include "components/exo/test/exo_test_helper.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 126 |
127 // This will update the bounds of the surface and take the viewport into | 127 // This will update the bounds of the surface and take the viewport into |
128 // account. | 128 // account. |
129 surface->Attach(buffer.get()); | 129 surface->Attach(buffer.get()); |
130 gfx::Size viewport(256, 256); | 130 gfx::Size viewport(256, 256); |
131 surface->SetViewport(viewport); | 131 surface->SetViewport(viewport); |
132 surface->Commit(); | 132 surface->Commit(); |
133 EXPECT_EQ(viewport.ToString(), surface->bounds().size().ToString()); | 133 EXPECT_EQ(viewport.ToString(), surface->bounds().size().ToString()); |
134 } | 134 } |
135 | 135 |
| 136 TEST_F(SurfaceTest, SetOnlyVisibleOnSecureOutput) { |
| 137 gfx::Size buffer_size(1, 1); |
| 138 scoped_ptr<Buffer> buffer( |
| 139 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); |
| 140 scoped_ptr<Surface> surface(new Surface); |
| 141 |
| 142 surface->Attach(buffer.get()); |
| 143 surface->SetOnlyVisibleOnSecureOutput(true); |
| 144 surface->Commit(); |
| 145 |
| 146 cc::TextureMailbox mailbox; |
| 147 scoped_ptr<cc::SingleReleaseCallback> release_callback; |
| 148 bool rv = surface->layer()->PrepareTextureMailbox(&mailbox, &release_callback, |
| 149 false); |
| 150 ASSERT_TRUE(rv); |
| 151 |
| 152 EXPECT_TRUE(mailbox.secure_output_only()); |
| 153 release_callback->Run(gpu::SyncToken(), false); |
| 154 } |
| 155 |
136 TEST_F(SurfaceTest, Commit) { | 156 TEST_F(SurfaceTest, Commit) { |
137 scoped_ptr<Surface> surface(new Surface); | 157 scoped_ptr<Surface> surface(new Surface); |
138 | 158 |
139 // Calling commit without a buffer should succeed. | 159 // Calling commit without a buffer should succeed. |
140 surface->Commit(); | 160 surface->Commit(); |
141 } | 161 } |
142 | 162 |
143 } // namespace | 163 } // namespace |
144 } // namespace exo | 164 } // namespace exo |
OLD | NEW |