| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 EXPECT_TRUE(manager->GpuAccessAllowed(NULL)); | 588 EXPECT_TRUE(manager->GpuAccessAllowed(NULL)); |
| 589 EXPECT_EQ(1u, manager->GetBlacklistedFeatureCount()); | 589 EXPECT_EQ(1u, manager->GetBlacklistedFeatureCount()); |
| 590 | 590 |
| 591 // Now assume browser gets GL strings from local state. | 591 // Now assume browser gets GL strings from local state. |
| 592 // The entry applies, blacklist more features than from the preliminary step. | 592 // The entry applies, blacklist more features than from the preliminary step. |
| 593 // However, GPU process is not blocked because this is all browser side and | 593 // However, GPU process is not blocked because this is all browser side and |
| 594 // happens before renderer launching. | 594 // happens before renderer launching. |
| 595 manager->SetGLStrings(kGLVendorMesa, kGLRendererMesa, kGLVersionMesa801); | 595 manager->SetGLStrings(kGLVendorMesa, kGLRendererMesa, kGLVersionMesa801); |
| 596 EXPECT_TRUE(manager->GpuAccessAllowed(NULL)); | 596 EXPECT_TRUE(manager->GpuAccessAllowed(NULL)); |
| 597 EXPECT_EQ(1u, manager->GetBlacklistedFeatureCount()); | 597 EXPECT_EQ(1u, manager->GetBlacklistedFeatureCount()); |
| 598 EXPECT_TRUE(manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL)); | 598 EXPECT_TRUE( |
| 599 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL)); |
| 599 } | 600 } |
| 600 | 601 |
| 601 TEST_F(GpuDataManagerImplPrivateTest, SetGLStringsNoEffects) { | 602 TEST_F(GpuDataManagerImplPrivateTest, SetGLStringsNoEffects) { |
| 602 const char* kGLVendorMesa = "Tungsten Graphics, Inc"; | 603 const char* kGLVendorMesa = "Tungsten Graphics, Inc"; |
| 603 const char* kGLRendererMesa = "Mesa DRI Intel(R) G41"; | 604 const char* kGLRendererMesa = "Mesa DRI Intel(R) G41"; |
| 604 const char* kGLVersionMesa801 = "2.1 Mesa 8.0.1-DEVEL"; | 605 const char* kGLVersionMesa801 = "2.1 Mesa 8.0.1-DEVEL"; |
| 605 const char* kGLVersionMesa802 = "2.1 Mesa 8.0.2-DEVEL"; | 606 const char* kGLVersionMesa802 = "2.1 Mesa 8.0.2-DEVEL"; |
| 606 | 607 |
| 607 ScopedGpuDataManagerImplPrivate manager; | 608 ScopedGpuDataManagerImplPrivate manager; |
| 608 EXPECT_EQ(0u, manager->GetBlacklistedFeatureCount()); | 609 EXPECT_EQ(0u, manager->GetBlacklistedFeatureCount()); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 638 gpu_info.gl_vendor = kGLVendorMesa; | 639 gpu_info.gl_vendor = kGLVendorMesa; |
| 639 gpu_info.gl_renderer = kGLRendererMesa; | 640 gpu_info.gl_renderer = kGLRendererMesa; |
| 640 gpu_info.gl_version = kGLVersionMesa801; | 641 gpu_info.gl_version = kGLVersionMesa801; |
| 641 gpu_info.driver_vendor = "Mesa"; | 642 gpu_info.driver_vendor = "Mesa"; |
| 642 gpu_info.driver_version = "8.0.1"; | 643 gpu_info.driver_version = "8.0.1"; |
| 643 manager->InitializeForTesting(blacklist_json, gpu_info); | 644 manager->InitializeForTesting(blacklist_json, gpu_info); |
| 644 | 645 |
| 645 // Full GPUInfo, the entry applies. | 646 // Full GPUInfo, the entry applies. |
| 646 EXPECT_TRUE(manager->GpuAccessAllowed(NULL)); | 647 EXPECT_TRUE(manager->GpuAccessAllowed(NULL)); |
| 647 EXPECT_EQ(1u, manager->GetBlacklistedFeatureCount()); | 648 EXPECT_EQ(1u, manager->GetBlacklistedFeatureCount()); |
| 648 EXPECT_TRUE(manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL)); | 649 EXPECT_TRUE( |
| 650 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL)); |
| 649 | 651 |
| 650 // Now assume browser gets GL strings from local state. | 652 // Now assume browser gets GL strings from local state. |
| 651 // SetGLStrings() has no effects because GPUInfo already got these strings. | 653 // SetGLStrings() has no effects because GPUInfo already got these strings. |
| 652 // (Otherwise the entry should not apply.) | 654 // (Otherwise the entry should not apply.) |
| 653 manager->SetGLStrings(kGLVendorMesa, kGLRendererMesa, kGLVersionMesa802); | 655 manager->SetGLStrings(kGLVendorMesa, kGLRendererMesa, kGLVersionMesa802); |
| 654 EXPECT_TRUE(manager->GpuAccessAllowed(NULL)); | 656 EXPECT_TRUE(manager->GpuAccessAllowed(NULL)); |
| 655 EXPECT_EQ(1u, manager->GetBlacklistedFeatureCount()); | 657 EXPECT_EQ(1u, manager->GetBlacklistedFeatureCount()); |
| 656 EXPECT_TRUE(manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL)); | 658 EXPECT_TRUE( |
| 659 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL)); |
| 657 } | 660 } |
| 658 | 661 |
| 659 TEST_F(GpuDataManagerImplPrivateTest, SetGLStringsDefered) { | 662 TEST_F(GpuDataManagerImplPrivateTest, SetGLStringsDefered) { |
| 660 const char* kGLVendorMesa = "Tungsten Graphics, Inc"; | 663 const char* kGLVendorMesa = "Tungsten Graphics, Inc"; |
| 661 const char* kGLRendererMesa = "Mesa DRI Intel(R) G41"; | 664 const char* kGLRendererMesa = "Mesa DRI Intel(R) G41"; |
| 662 const char* kGLVersionMesa801 = "2.1 Mesa 8.0.1-DEVEL"; | 665 const char* kGLVersionMesa801 = "2.1 Mesa 8.0.1-DEVEL"; |
| 663 | 666 |
| 664 ScopedGpuDataManagerImplPrivate manager; | 667 ScopedGpuDataManagerImplPrivate manager; |
| 665 EXPECT_EQ(0u, manager->GetBlacklistedFeatureCount()); | 668 EXPECT_EQ(0u, manager->GetBlacklistedFeatureCount()); |
| 666 EXPECT_TRUE(manager->GpuAccessAllowed(NULL)); | 669 EXPECT_TRUE(manager->GpuAccessAllowed(NULL)); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 683 // Assume browser gets GL strings from local state. | 686 // Assume browser gets GL strings from local state. |
| 684 manager->SetGLStrings(kGLVendorMesa, kGLRendererMesa, kGLVersionMesa801); | 687 manager->SetGLStrings(kGLVendorMesa, kGLRendererMesa, kGLVersionMesa801); |
| 685 | 688 |
| 686 gpu::GPUInfo gpu_info; | 689 gpu::GPUInfo gpu_info; |
| 687 gpu_info.gpu.vendor_id = 0x8086; | 690 gpu_info.gpu.vendor_id = 0x8086; |
| 688 gpu_info.gpu.device_id = 0x0042; | 691 gpu_info.gpu.device_id = 0x0042; |
| 689 manager->InitializeForTesting(blacklist_json, gpu_info); | 692 manager->InitializeForTesting(blacklist_json, gpu_info); |
| 690 | 693 |
| 691 EXPECT_TRUE(manager->GpuAccessAllowed(NULL)); | 694 EXPECT_TRUE(manager->GpuAccessAllowed(NULL)); |
| 692 EXPECT_EQ(1u, manager->GetBlacklistedFeatureCount()); | 695 EXPECT_EQ(1u, manager->GetBlacklistedFeatureCount()); |
| 693 EXPECT_TRUE(manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL)); | 696 EXPECT_TRUE( |
| 697 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL)); |
| 694 } | 698 } |
| 695 #endif // OS_LINUX | 699 #endif // OS_LINUX |
| 696 | 700 |
| 697 TEST_F(GpuDataManagerImplPrivateTest, GpuDriverBugListSingle) { | 701 TEST_F(GpuDataManagerImplPrivateTest, GpuDriverBugListSingle) { |
| 698 ScopedGpuDataManagerImplPrivate manager; | 702 ScopedGpuDataManagerImplPrivate manager; |
| 699 manager->gpu_driver_bugs_.insert(5); | 703 manager->gpu_driver_bugs_.insert(5); |
| 700 | 704 |
| 701 base::CommandLine command_line(0, NULL); | 705 base::CommandLine command_line(0, NULL); |
| 702 manager->AppendGpuCommandLine(&command_line, nullptr); | 706 manager->AppendGpuCommandLine(&command_line, nullptr); |
| 703 | 707 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 EXPECT_TRUE(manager->UpdateActiveGpu(0x8086, 0x04a1)); | 836 EXPECT_TRUE(manager->UpdateActiveGpu(0x8086, 0x04a1)); |
| 833 { | 837 { |
| 834 base::RunLoop run_loop; | 838 base::RunLoop run_loop; |
| 835 run_loop.RunUntilIdle(); | 839 run_loop.RunUntilIdle(); |
| 836 } | 840 } |
| 837 EXPECT_TRUE(observer.gpu_info_updated()); | 841 EXPECT_TRUE(observer.gpu_info_updated()); |
| 838 EXPECT_EQ(1u, manager->GetBlacklistedFeatureCount()); | 842 EXPECT_EQ(1u, manager->GetBlacklistedFeatureCount()); |
| 839 } | 843 } |
| 840 | 844 |
| 841 } // namespace content | 845 } // namespace content |
| OLD | NEW |