blob: 1bd8f4047e6b9e9c7479e9ad7aeefbf243204c72 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/common/gpu_feature_flags.h"
#include "testing/gtest/include/gtest/gtest.h"
TEST(GpuFeatureFlagsTest, GpuFeatureFlagsBasic) {
// Test that by default all flags are set to false.
GpuFeatureFlags flags;
EXPECT_EQ(flags.flags(), 0u);
// Test SetFlags().
GpuFeatureFlags flags2;
flags2.set_flags(GpuFeatureFlags::kGpuFeatureAcceleratedCompositing |
GpuFeatureFlags::kGpuFeatureWebgl);
EXPECT_EQ(flags2.flags(),
static_cast<uint32>(
GpuFeatureFlags::kGpuFeatureAcceleratedCompositing |
GpuFeatureFlags::kGpuFeatureWebgl));
// Test Combine() is basically OR operation per flag.
flags.set_flags(GpuFeatureFlags::kGpuFeatureAccelerated2dCanvas);
flags.Combine(flags2);
EXPECT_EQ(flags.flags(),
static_cast<uint32>(
GpuFeatureFlags::kGpuFeatureAccelerated2dCanvas |
GpuFeatureFlags::kGpuFeatureAcceleratedCompositing |
GpuFeatureFlags::kGpuFeatureWebgl));
// Test the currently supported feature set.
flags.set_flags(GpuFeatureFlags::kGpuFeatureAll);
EXPECT_EQ(flags.flags(),
static_cast<uint32>(
GpuFeatureFlags::kGpuFeatureAccelerated2dCanvas |
GpuFeatureFlags::kGpuFeatureAcceleratedCompositing |
GpuFeatureFlags::kGpuFeatureWebgl));
// Test StringToGpuFeatureType.
EXPECT_EQ(GpuFeatureFlags::StringToGpuFeatureType("accelerated_2d_canvas"),
GpuFeatureFlags::kGpuFeatureAccelerated2dCanvas);
EXPECT_EQ(GpuFeatureFlags::StringToGpuFeatureType("accelerated_compositing"),
GpuFeatureFlags::kGpuFeatureAcceleratedCompositing);
EXPECT_EQ(GpuFeatureFlags::StringToGpuFeatureType("webgl"),
GpuFeatureFlags::kGpuFeatureWebgl);
EXPECT_EQ(GpuFeatureFlags::StringToGpuFeatureType("all"),
GpuFeatureFlags::kGpuFeatureAll);
EXPECT_EQ(GpuFeatureFlags::StringToGpuFeatureType("xxx"),
GpuFeatureFlags::kGpuFeatureUnknown);
}
|