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

Side by Side Diff: content/browser/gpu/gpu_blacklist_unittest.cc

Issue 9959085: Make it possible to blacklist gpu's based on the Windows experience index. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1025/src/
Patch Set: Created 8 years, 8 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/gpu/gpu_blacklist.cc ('k') | content/browser/gpu/gpu_data_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <vector> 5 #include <vector>
6 6
7 #include "base/base_paths.h" 7 #include "base/base_paths.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
(...skipping 14 matching lines...) Expand all
26 26
27 protected: 27 protected:
28 void SetUp() { 28 void SetUp() {
29 gpu_info_.vendor_id = 0x10de; 29 gpu_info_.vendor_id = 0x10de;
30 gpu_info_.device_id = 0x0640; 30 gpu_info_.device_id = 0x0640;
31 gpu_info_.driver_vendor = "NVIDIA"; 31 gpu_info_.driver_vendor = "NVIDIA";
32 gpu_info_.driver_version = "1.6.18"; 32 gpu_info_.driver_version = "1.6.18";
33 gpu_info_.driver_date = "7-14-2009"; 33 gpu_info_.driver_date = "7-14-2009";
34 gpu_info_.gl_vendor = "NVIDIA Corporation"; 34 gpu_info_.gl_vendor = "NVIDIA Corporation";
35 gpu_info_.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine"; 35 gpu_info_.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine";
36 gpu_info_.performance_stats.graphics = 5.0;
37 gpu_info_.performance_stats.gaming = 5.0;
38 gpu_info_.performance_stats.overall = 5.0;
36 } 39 }
37 40
38 void TearDown() { 41 void TearDown() {
39 } 42 }
40 43
41 private: 44 private:
42 content::GPUInfo gpu_info_; 45 content::GPUInfo gpu_info_;
43 }; 46 };
44 47
45 TEST_F(GpuBlacklistTest, CurrentBlacklistValidation) { 48 TEST_F(GpuBlacklistTest, CurrentBlacklistValidation) {
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 650
648 GpuBlacklist blacklist("1.0"); 651 GpuBlacklist blacklist("1.0");
649 EXPECT_TRUE( 652 EXPECT_TRUE(
650 blacklist.LoadGpuBlacklist(gl_renderer_json, GpuBlacklist::kAllOs)); 653 blacklist.LoadGpuBlacklist(gl_renderer_json, GpuBlacklist::kAllOs));
651 GpuFeatureFlags flags = blacklist.DetermineGpuFeatureFlags( 654 GpuFeatureFlags flags = blacklist.DetermineGpuFeatureFlags(
652 GpuBlacklist::kOsWin, os_version.get(), gpu_info()); 655 GpuBlacklist::kOsWin, os_version.get(), gpu_info());
653 EXPECT_EQ(flags.flags(), 656 EXPECT_EQ(flags.flags(),
654 static_cast<uint32>(GpuFeatureFlags::kGpuFeatureWebgl)); 657 static_cast<uint32>(GpuFeatureFlags::kGpuFeatureWebgl));
655 } 658 }
656 659
660 TEST_F(GpuBlacklistTest, PerfGraphics) {
661 const std::string json =
662 "{\n"
663 " \"name\": \"gpu blacklist\",\n"
664 " \"version\": \"0.1\",\n"
665 " \"entries\": [\n"
666 " {\n"
667 " \"id\": 1,\n"
668 " \"perf_graphics\": {\n"
669 " \"op\": \"<\",\n"
670 " \"value\": \"6.0\"\n"
671 " },\n"
672 " \"blacklist\": [\n"
673 " \"webgl\"\n"
674 " ]\n"
675 " }\n"
676 " ]\n"
677 "}";
678 scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
679
680 GpuBlacklist blacklist("1.0");
681 EXPECT_TRUE(
682 blacklist.LoadGpuBlacklist(json, GpuBlacklist::kAllOs));
683 GpuFeatureFlags flags = blacklist.DetermineGpuFeatureFlags(
684 GpuBlacklist::kOsWin, os_version.get(), gpu_info());
685 EXPECT_EQ(flags.flags(),
686 static_cast<uint32>(GpuFeatureFlags::kGpuFeatureWebgl));
687 }
688
689 TEST_F(GpuBlacklistTest, PerfGaming) {
690 const std::string json =
691 "{\n"
692 " \"name\": \"gpu blacklist\",\n"
693 " \"version\": \"0.1\",\n"
694 " \"entries\": [\n"
695 " {\n"
696 " \"id\": 1,\n"
697 " \"perf_gaming\": {\n"
698 " \"op\": \"<=\",\n"
699 " \"value\": \"4.0\"\n"
700 " },\n"
701 " \"blacklist\": [\n"
702 " \"webgl\"\n"
703 " ]\n"
704 " }\n"
705 " ]\n"
706 "}";
707 scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
708
709 GpuBlacklist blacklist("1.0");
710 EXPECT_TRUE(
711 blacklist.LoadGpuBlacklist(json, GpuBlacklist::kAllOs));
712 GpuFeatureFlags flags = blacklist.DetermineGpuFeatureFlags(
713 GpuBlacklist::kOsWin, os_version.get(), gpu_info());
714 EXPECT_EQ(flags.flags(), 0u);
715 }
716
717 TEST_F(GpuBlacklistTest, PerfOverall) {
718 const std::string json =
719 "{\n"
720 " \"name\": \"gpu blacklist\",\n"
721 " \"version\": \"0.1\",\n"
722 " \"entries\": [\n"
723 " {\n"
724 " \"id\": 1,\n"
725 " \"perf_overall\": {\n"
726 " \"op\": \"between\",\n"
727 " \"value\": \"1.0\",\n"
728 " \"value2\": \"9.0\"\n"
729 " },\n"
730 " \"blacklist\": [\n"
731 " \"webgl\"\n"
732 " ]\n"
733 " }\n"
734 " ]\n"
735 "}";
736 scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
737
738 GpuBlacklist blacklist("1.0");
739 EXPECT_TRUE(
740 blacklist.LoadGpuBlacklist(json, GpuBlacklist::kAllOs));
741 GpuFeatureFlags flags = blacklist.DetermineGpuFeatureFlags(
742 GpuBlacklist::kOsWin, os_version.get(), gpu_info());
743 EXPECT_EQ(flags.flags(),
744 static_cast<uint32>(GpuFeatureFlags::kGpuFeatureWebgl));
745 }
746
657 TEST_F(GpuBlacklistTest, DisabledEntry) { 747 TEST_F(GpuBlacklistTest, DisabledEntry) {
658 const std::string disabled_json = 748 const std::string disabled_json =
659 "{\n" 749 "{\n"
660 " \"name\": \"gpu blacklist\",\n" 750 " \"name\": \"gpu blacklist\",\n"
661 " \"version\": \"0.1\",\n" 751 " \"version\": \"0.1\",\n"
662 " \"entries\": [\n" 752 " \"entries\": [\n"
663 " {\n" 753 " {\n"
664 " \"id\": 1,\n" 754 " \"id\": 1,\n"
665 " \"disabled\": true,\n" 755 " \"disabled\": true,\n"
666 " \"blacklist\": [\n" 756 " \"blacklist\": [\n"
(...skipping 14 matching lines...) Expand all
681 bool disabled = false; 771 bool disabled = false;
682 blacklist.GetGpuFeatureFlagEntries( 772 blacklist.GetGpuFeatureFlagEntries(
683 GpuFeatureFlags::kGpuFeatureAll, flag_entries, disabled); 773 GpuFeatureFlags::kGpuFeatureAll, flag_entries, disabled);
684 EXPECT_EQ(flag_entries.size(), 0u); 774 EXPECT_EQ(flag_entries.size(), 0u);
685 disabled = true; 775 disabled = true;
686 blacklist.GetGpuFeatureFlagEntries( 776 blacklist.GetGpuFeatureFlagEntries(
687 GpuFeatureFlags::kGpuFeatureAll, flag_entries, disabled); 777 GpuFeatureFlags::kGpuFeatureAll, flag_entries, disabled);
688 EXPECT_EQ(flag_entries.size(), 1u); 778 EXPECT_EQ(flag_entries.size(), 1u);
689 } 779 }
690 780
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_blacklist.cc ('k') | content/browser/gpu/gpu_data_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698