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

Unified Diff: chrome/common/gpu_feature_flags_unittest.cc

Issue 5612002: Blacklist bad GPU drivers: currenly we disable all gpu related features if th... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 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
Index: chrome/common/gpu_feature_flags_unittest.cc
===================================================================
--- chrome/common/gpu_feature_flags_unittest.cc (revision 0)
+++ chrome/common/gpu_feature_flags_unittest.cc (revision 0)
@@ -0,0 +1,39 @@
+// 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 gpu_feature_flags;
+ EXPECT_FALSE(gpu_feature_flags.is_accelerated_2d_canvas_blacklisted());
+ EXPECT_FALSE(gpu_feature_flags.is_accelerated_compositing_blacklisted());
+ EXPECT_FALSE(gpu_feature_flags.is_webgl_blacklisted());
+
+ // Test SetFlags().
+ GpuFeatureFlags gpu_feature_flags2;
+ gpu_feature_flags2.SetFlags(false, true, true);
+ EXPECT_FALSE(gpu_feature_flags2.is_accelerated_2d_canvas_blacklisted());
+ EXPECT_TRUE(gpu_feature_flags2.is_accelerated_compositing_blacklisted());
+ EXPECT_TRUE(gpu_feature_flags2.is_webgl_blacklisted());
+
+ // Test Combine() is basically OR operation per flag.
+ gpu_feature_flags.Combine(gpu_feature_flags2);
+ EXPECT_FALSE(gpu_feature_flags.is_accelerated_2d_canvas_blacklisted());
+ EXPECT_TRUE(gpu_feature_flags.is_accelerated_compositing_blacklisted());
+ EXPECT_TRUE(gpu_feature_flags.is_webgl_blacklisted());
+
+ // 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("any"),
+ GpuFeatureFlags::kGpuFeatureAny);
+ EXPECT_EQ(GpuFeatureFlags::StringToGpuFeatureType("xxx"),
+ GpuFeatureFlags::kGpuFeatureUnknown);
+}

Powered by Google App Engine
This is Rietveld 408576698