Show Pages in chrome://md-settings
[chromium-blink-merge.git] / gpu / config / gpu_util_unittest.cc
blobe1264dbf95bf8deb79991af2f30fb82164d55285
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "gpu/config/gpu_util.h"
6 #include "testing/gtest/include/gtest/gtest.h"
8 namespace gpu {
10 TEST(GpuUtilTest, MergeFeatureSets) {
12 // Merge two empty sets.
13 std::set<int> src;
14 std::set<int> dst;
15 EXPECT_TRUE(dst.empty());
16 MergeFeatureSets(&dst, src);
17 EXPECT_TRUE(dst.empty());
20 // Merge an empty set into a set with elements.
21 std::set<int> src;
22 std::set<int> dst;
23 dst.insert(1);
24 EXPECT_EQ(1u, dst.size());
25 MergeFeatureSets(&dst, src);
26 EXPECT_EQ(1u, dst.size());
29 // Merge two sets where the source elements are already in the target set.
30 std::set<int> src;
31 std::set<int> dst;
32 src.insert(1);
33 dst.insert(1);
34 EXPECT_EQ(1u, dst.size());
35 MergeFeatureSets(&dst, src);
36 EXPECT_EQ(1u, dst.size());
39 // Merge two sets with different elements.
40 std::set<int> src;
41 std::set<int> dst;
42 src.insert(1);
43 dst.insert(2);
44 EXPECT_EQ(1u, dst.size());
45 MergeFeatureSets(&dst, src);
46 EXPECT_EQ(2u, dst.size());
50 TEST(GpuUtilTest, StringToFeatureSet) {
52 // zero feature.
53 std::set<int> features;
54 StringToFeatureSet("", &features);
55 EXPECT_EQ(0u, features.size());
58 // One features.
59 std::set<int> features;
60 StringToFeatureSet("4", &features);
61 EXPECT_EQ(1u, features.size());
64 // Multiple features.
65 std::set<int> features;
66 StringToFeatureSet("1,9", &features);
67 EXPECT_EQ(2u, features.size());
71 } // namespace gpu