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

Unified Diff: cc/surfaces/surface_aggregator_unittest.cc

Issue 1496103002: Reusing base::IdType<...> to implement SurfaceId. Base URL: https://chromium.googlesource.com/chromium/src.git@type-safe-id-base
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/surfaces/surface_aggregator_perftest.cc ('k') | cc/surfaces/surface_factory_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/surface_aggregator_unittest.cc
diff --git a/cc/surfaces/surface_aggregator_unittest.cc b/cc/surfaces/surface_aggregator_unittest.cc
index 53b01e046b67c24d594651c6ab2a57b1ccbc5d17..d9302c3f658a84b307ab7bf0987ac53e48d06d2f 100644
--- a/cc/surfaces/surface_aggregator_unittest.cc
+++ b/cc/surfaces/surface_aggregator_unittest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <limits>
+
#include "cc/output/compositor_frame.h"
#include "cc/output/delegated_frame_data.h"
#include "cc/quads/render_pass.h"
@@ -30,9 +32,7 @@ namespace cc {
namespace {
SurfaceId InvalidSurfaceId() {
- static SurfaceId invalid;
- invalid.id = static_cast<uint64_t>(-1);
- return invalid;
+ return SurfaceId::FromUnsafeValue(std::numeric_limits<uint64_t>::max());
}
gfx::Size SurfaceSize() {
@@ -88,7 +88,7 @@ class SurfaceAggregatorTest : public testing::Test {
};
TEST_F(SurfaceAggregatorTest, ValidSurfaceNoFrame) {
- SurfaceId one_id(7);
+ SurfaceId one_id = SurfaceId::FromUnsafeValue(7);
factory_.Create(one_id);
Surface* surface = manager_.GetSurfaceForId(one_id);
@@ -1806,7 +1806,7 @@ void SubmitCompositorFrameWithResources(ResourceId* resource_ids,
TEST_F(SurfaceAggregatorWithResourcesTest, TakeResourcesOneSurface) {
ResourceTrackingSurfaceFactoryClient client;
SurfaceFactory factory(&manager_, &client);
- SurfaceId surface_id(7u);
+ SurfaceId surface_id = SurfaceId::FromUnsafeValue(7u);
factory.Create(surface_id);
Surface* surface = manager_.GetSurfaceForId(surface_id);
@@ -1845,7 +1845,7 @@ TEST_F(SurfaceAggregatorWithResourcesTest, TakeResourcesOneSurface) {
TEST_F(SurfaceAggregatorWithResourcesTest, TakeInvalidResources) {
ResourceTrackingSurfaceFactoryClient client;
SurfaceFactory factory(&manager_, &client);
- SurfaceId surface_id(7u);
+ SurfaceId surface_id = SurfaceId::FromUnsafeValue(7u);
factory.Create(surface_id);
Surface* surface = manager_.GetSurfaceForId(surface_id);
@@ -1885,11 +1885,11 @@ TEST_F(SurfaceAggregatorWithResourcesTest, TakeInvalidResources) {
TEST_F(SurfaceAggregatorWithResourcesTest, TwoSurfaces) {
ResourceTrackingSurfaceFactoryClient client;
SurfaceFactory factory(&manager_, &client);
- SurfaceId surface1_id(7u);
+ SurfaceId surface1_id = SurfaceId::FromUnsafeValue(7u);
factory.Create(surface1_id);
Surface* surface1 = manager_.GetSurfaceForId(surface1_id);
- SurfaceId surface2_id(8u);
+ SurfaceId surface2_id = SurfaceId::FromUnsafeValue(8u);
factory.Create(surface2_id);
Surface* surface2 = manager_.GetSurfaceForId(surface2_id);
@@ -1940,13 +1940,13 @@ TEST_F(SurfaceAggregatorWithResourcesTest, TwoSurfaces) {
TEST_F(SurfaceAggregatorWithResourcesTest, InvalidChildSurface) {
ResourceTrackingSurfaceFactoryClient client;
SurfaceFactory factory(&manager_, &client);
- SurfaceId root_surface_id(7u);
+ SurfaceId root_surface_id = SurfaceId::FromUnsafeValue(7u);
factory.Create(root_surface_id);
Surface* root_surface = manager_.GetSurfaceForId(root_surface_id);
- SurfaceId middle_surface_id(8u);
+ SurfaceId middle_surface_id = SurfaceId::FromUnsafeValue(8u);
factory.Create(middle_surface_id);
Surface* middle_surface = manager_.GetSurfaceForId(middle_surface_id);
- SurfaceId child_surface_id(9u);
+ SurfaceId child_surface_id = SurfaceId::FromUnsafeValue(9u);
factory.Create(child_surface_id);
Surface* child_surface = manager_.GetSurfaceForId(child_surface_id);
« no previous file with comments | « cc/surfaces/surface_aggregator_perftest.cc ('k') | cc/surfaces/surface_factory_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698