OLD | NEW |
1 // Copyright (c) 2012 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/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "chrome/test/base/ui_test_utils.h" | 24 #include "chrome/test/base/ui_test_utils.h" |
25 #include "content/public/browser/gpu_data_manager.h" | 25 #include "content/public/browser/gpu_data_manager.h" |
26 #include "content/public/browser/notification_observer.h" | 26 #include "content/public/browser/notification_observer.h" |
27 #include "content/public/browser/notification_registrar.h" | 27 #include "content/public/browser/notification_registrar.h" |
28 #include "content/public/test/browser_test_utils.h" | 28 #include "content/public/test/browser_test_utils.h" |
29 #include "extensions/browser/api/management/management_api.h" | 29 #include "extensions/browser/api/management/management_api.h" |
30 #include "extensions/browser/extension_dialog_auto_confirm.h" | 30 #include "extensions/browser/extension_dialog_auto_confirm.h" |
31 #include "extensions/browser/extension_system.h" | 31 #include "extensions/browser/extension_system.h" |
32 #include "extensions/browser/install/extension_install_ui.h" | 32 #include "extensions/browser/install/extension_install_ui.h" |
33 #include "gpu/config/gpu_feature_type.h" | 33 #include "gpu/config/gpu_feature_type.h" |
34 #include "gpu/config/gpu_info.h" | |
35 #include "net/dns/mock_host_resolver.h" | 34 #include "net/dns/mock_host_resolver.h" |
36 #include "net/test/embedded_test_server/embedded_test_server.h" | 35 #include "net/test/embedded_test_server/embedded_test_server.h" |
37 #include "ui/gl/gl_switches.h" | 36 #include "ui/gl/gl_switches.h" |
38 | 37 |
39 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) | 38 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
40 #include "chrome/browser/supervised_user/supervised_user_constants.h" | 39 #include "chrome/browser/supervised_user/supervised_user_constants.h" |
41 #endif // BUILDFLAG(ENABLE_SUPERVISED_USERS) | 40 #endif // BUILDFLAG(ENABLE_SUPERVISED_USERS) |
42 | 41 |
43 using gpu::GpuFeatureType; | |
44 | |
45 namespace utils = extension_function_test_utils; | 42 namespace utils = extension_function_test_utils; |
46 | 43 |
47 namespace extensions { | 44 namespace extensions { |
48 | 45 |
49 namespace { | 46 namespace { |
50 | 47 |
51 class WebstoreInstallListener : public WebstoreInstaller::Delegate { | 48 class WebstoreInstallListener : public WebstoreInstaller::Delegate { |
52 public: | 49 public: |
53 WebstoreInstallListener() | 50 WebstoreInstallListener() |
54 : received_failure_(false), received_success_(false), waiting_(false) {} | 51 : received_failure_(false), received_success_(false), waiting_(false) {} |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 }; | 404 }; |
408 | 405 |
409 // Tests getWebGLStatus function when WebGL is allowed. | 406 // Tests getWebGLStatus function when WebGL is allowed. |
410 IN_PROC_BROWSER_TEST_F(ExtensionWebstoreGetWebGLStatusTest, Allowed) { | 407 IN_PROC_BROWSER_TEST_F(ExtensionWebstoreGetWebGLStatusTest, Allowed) { |
411 bool webgl_allowed = true; | 408 bool webgl_allowed = true; |
412 RunTest(webgl_allowed); | 409 RunTest(webgl_allowed); |
413 } | 410 } |
414 | 411 |
415 // Tests getWebGLStatus function when WebGL is blacklisted. | 412 // Tests getWebGLStatus function when WebGL is blacklisted. |
416 IN_PROC_BROWSER_TEST_F(ExtensionWebstoreGetWebGLStatusTest, Blocked) { | 413 IN_PROC_BROWSER_TEST_F(ExtensionWebstoreGetWebGLStatusTest, Blocked) { |
417 static const std::string json_blacklist = | 414 content::GpuDataManager::GetInstance()->BlacklistWebGLForTesting(); |
418 "{\n" | |
419 " \"name\": \"gpu blacklist\",\n" | |
420 " \"version\": \"1.0\",\n" | |
421 " \"entries\": [\n" | |
422 " {\n" | |
423 " \"id\": 1,\n" | |
424 " \"features\": [\n" | |
425 " \"accelerated_webgl\"\n" | |
426 " ]\n" | |
427 " }\n" | |
428 " ]\n" | |
429 "}"; | |
430 gpu::GPUInfo gpu_info; | |
431 content::GpuDataManager::GetInstance()->InitializeForTesting( | |
432 json_blacklist, gpu_info); | |
433 EXPECT_TRUE(content::GpuDataManager::GetInstance()->IsFeatureBlacklisted( | 415 EXPECT_TRUE(content::GpuDataManager::GetInstance()->IsFeatureBlacklisted( |
434 gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL)); | 416 gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL)); |
435 | 417 |
436 bool webgl_allowed = false; | 418 bool webgl_allowed = false; |
437 RunTest(webgl_allowed); | 419 RunTest(webgl_allowed); |
438 } | 420 } |
439 | 421 |
440 } // namespace extensions | 422 } // namespace extensions |
OLD | NEW |