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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
382 } | 382 } |
383 | 383 |
384 #endif // BUILDFLAG(ENABLE_SUPERVISED_USERS) | 384 #endif // BUILDFLAG(ENABLE_SUPERVISED_USERS) |
385 | 385 |
386 class ExtensionWebstoreGetWebGLStatusTest : public InProcessBrowserTest { | 386 class ExtensionWebstoreGetWebGLStatusTest : public InProcessBrowserTest { |
387 protected: | 387 protected: |
388 void RunTest(bool webgl_allowed) { | 388 void RunTest(bool webgl_allowed) { |
389 // If Gpu access is disallowed then WebGL will not be available. | 389 // If Gpu access is disallowed then WebGL will not be available. |
390 if (!content::GpuDataManager::GetInstance()->GpuAccessAllowed(NULL)) | 390 if (!content::GpuDataManager::GetInstance()->GpuAccessAllowed(NULL)) |
391 webgl_allowed = false; | 391 webgl_allowed = false; |
392 if (content::GpuDataManager::GetInstance()->ShouldUseSwiftShader()) | |
393 webgl_allowed = true; | |
392 | 394 |
393 static const char kEmptyArgs[] = "[]"; | 395 static const char kEmptyArgs[] = "[]"; |
394 static const char kWebGLStatusAllowed[] = "webgl_allowed"; | 396 static const char kWebGLStatusAllowed[] = "webgl_allowed"; |
395 static const char kWebGLStatusBlocked[] = "webgl_blocked"; | 397 static const char kWebGLStatusBlocked[] = "webgl_blocked"; |
396 scoped_refptr<WebstorePrivateGetWebGLStatusFunction> function = | 398 scoped_refptr<WebstorePrivateGetWebGLStatusFunction> function = |
397 new WebstorePrivateGetWebGLStatusFunction(); | 399 new WebstorePrivateGetWebGLStatusFunction(); |
398 std::unique_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( | 400 std::unique_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( |
399 function.get(), kEmptyArgs, browser())); | 401 function.get(), kEmptyArgs, browser())); |
400 ASSERT_TRUE(result); | 402 ASSERT_TRUE(result); |
401 EXPECT_EQ(base::Value::Type::STRING, result->GetType()); | 403 EXPECT_EQ(base::Value::Type::STRING, result->GetType()); |
(...skipping 21 matching lines...) Expand all Loading... | |
423 " \"id\": 1,\n" | 425 " \"id\": 1,\n" |
424 " \"features\": [\n" | 426 " \"features\": [\n" |
425 " \"webgl\"\n" | 427 " \"webgl\"\n" |
426 " ]\n" | 428 " ]\n" |
427 " }\n" | 429 " }\n" |
428 " ]\n" | 430 " ]\n" |
429 "}"; | 431 "}"; |
430 gpu::GPUInfo gpu_info; | 432 gpu::GPUInfo gpu_info; |
431 content::GpuDataManager::GetInstance()->InitializeForTesting( | 433 content::GpuDataManager::GetInstance()->InitializeForTesting( |
432 json_blacklist, gpu_info); | 434 json_blacklist, gpu_info); |
433 EXPECT_TRUE(content::GpuDataManager::GetInstance()->IsFeatureBlacklisted( | 435 if (content::GpuDataManager::GetInstance()->ShouldUseSwiftShader()) { |
Devlin
2017/03/01 23:47:24
It seems strange that this change means the GpuDat
sugoi1
2017/03/02 00:17:08
When WebGL is blacklisted on a given GPU, SwiftSha
| |
434 gpu::GPU_FEATURE_TYPE_WEBGL)); | 436 EXPECT_FALSE(content::GpuDataManager::GetInstance()->IsFeatureBlacklisted( |
Devlin
2017/03/02 21:59:29
nit: How about
content::GpuDataManager* gpu_manage
sugoi
2017/03/06 18:31:42
Done.
| |
437 gpu::GPU_FEATURE_TYPE_WEBGL)); | |
438 } else { | |
439 EXPECT_TRUE(content::GpuDataManager::GetInstance()->IsFeatureBlacklisted( | |
440 gpu::GPU_FEATURE_TYPE_WEBGL)); | |
441 } | |
435 | 442 |
436 bool webgl_allowed = false; | 443 bool webgl_allowed = false; |
437 RunTest(webgl_allowed); | 444 RunTest(webgl_allowed); |
438 } | 445 } |
439 | 446 |
440 } // namespace extensions | 447 } // namespace extensions |
OLD | NEW |