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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
14 #include "base/threading/sequenced_worker_pool.h" | 14 #include "base/threading/sequenced_worker_pool.h" |
15 #include "chrome/browser/extensions/extension_browsertest.h" | 15 #include "chrome/browser/extensions/extension_browsertest.h" |
16 #include "chrome/browser/extensions/requirements_checker.h" | 16 #include "chrome/browser/extensions/requirements_checker.h" |
17 #include "chrome/common/chrome_paths.h" | 17 #include "chrome/common/chrome_paths.h" |
18 #include "chrome/common/extensions/extension.h" | 18 #include "chrome/common/extensions/extension.h" |
19 #include "chrome/common/extensions/extension_file_util.h" | 19 #include "chrome/common/extensions/extension_file_util.h" |
20 #include "chrome/test/base/test_launcher_utils.h" | 20 #include "chrome/test/base/test_launcher_utils.h" |
21 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
22 #include "content/public/browser/gpu_data_manager.h" | 22 #include "content/public/browser/gpu_data_manager.h" |
| 23 #include "content/public/common/gpu_info.h" |
23 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
24 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
25 #include "ui/gl/gl_switches.h" | 26 #include "ui/gl/gl_switches.h" |
26 | 27 |
27 namespace extensions { | 28 namespace extensions { |
28 | 29 |
29 class RequirementsCheckerBrowserTest : public ExtensionBrowserTest { | 30 class RequirementsCheckerBrowserTest : public ExtensionBrowserTest { |
30 public: | 31 public: |
31 void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 32 void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
32 // In linux, we need to launch GPU process to decide if WebGL is allowed. | 33 // In linux, we need to launch GPU process to decide if WebGL is allowed. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 "{\n" | 67 "{\n" |
67 " \"name\": \"gpu blacklist\",\n" | 68 " \"name\": \"gpu blacklist\",\n" |
68 " \"version\": \"1.0\",\n" | 69 " \"version\": \"1.0\",\n" |
69 " \"entries\": [\n" | 70 " \"entries\": [\n" |
70 " {\n" | 71 " {\n" |
71 " \"id\": 1,\n" | 72 " \"id\": 1,\n" |
72 " \"blacklist\": [\"" + JoinString(features, "\", \"") + "\"]\n" | 73 " \"blacklist\": [\"" + JoinString(features, "\", \"") + "\"]\n" |
73 " }\n" | 74 " }\n" |
74 " ]\n" | 75 " ]\n" |
75 "}"; | 76 "}"; |
76 content::GpuDataManager::GetInstance()->Initialize("0", json_blacklist); | 77 content::GPUInfo gpu_info; |
| 78 content::GpuDataManager::GetInstance()->InitializeForTesting( |
| 79 json_blacklist, gpu_info); |
77 } | 80 } |
78 | 81 |
79 protected: | 82 protected: |
80 std::vector<std::string> requirement_errors_; | 83 std::vector<std::string> requirement_errors_; |
81 RequirementsChecker checker_; | 84 RequirementsChecker checker_; |
82 }; | 85 }; |
83 | 86 |
84 IN_PROC_BROWSER_TEST_F(RequirementsCheckerBrowserTest, CheckEmptyExtension) { | 87 IN_PROC_BROWSER_TEST_F(RequirementsCheckerBrowserTest, CheckEmptyExtension) { |
85 scoped_refptr<const Extension> extension( | 88 scoped_refptr<const Extension> extension( |
86 LoadExtensionFromDirName("no_requirements")); | 89 LoadExtensionFromDirName("no_requirements")); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 LoadExtensionFromDirName("require_3d")); | 184 LoadExtensionFromDirName("require_3d")); |
182 ASSERT_TRUE(extension.get()); | 185 ASSERT_TRUE(extension.get()); |
183 | 186 |
184 checker_.Check(extension, base::Bind( | 187 checker_.Check(extension, base::Bind( |
185 &RequirementsCheckerBrowserTest::ValidateRequirementErrors, | 188 &RequirementsCheckerBrowserTest::ValidateRequirementErrors, |
186 base::Unretained(this), std::vector<std::string>())); | 189 base::Unretained(this), std::vector<std::string>())); |
187 content::BrowserThread::GetBlockingPool()->FlushForTesting(); | 190 content::BrowserThread::GetBlockingPool()->FlushForTesting(); |
188 } | 191 } |
189 | 192 |
190 } // extensions | 193 } // extensions |
OLD | NEW |