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/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
13 #include "base/strings/string_util.h" | 13 #include "base/strings/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 "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
21 #include "content/public/browser/gpu_data_manager.h" | 22 #include "content/public/browser/gpu_data_manager.h" |
22 #include "gpu/config/gpu_info.h" | 23 #include "gpu/config/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: |
| 32 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 33 // We need to launch GPU process to decide if WebGL is allowed. |
| 34 // Run it on top of osmesa to avoid bot driver issues. |
| 35 #if !defined(OS_MACOSX) |
| 36 CHECK(test_launcher_utils::OverrideGLImplementation( |
| 37 command_line, gfx::kGLImplementationOSMesaName)) << |
| 38 "kUseGL must not be set multiple times!"; |
| 39 #endif |
| 40 } |
| 41 |
31 scoped_refptr<const Extension> LoadExtensionFromDirName( | 42 scoped_refptr<const Extension> LoadExtensionFromDirName( |
32 const std::string& extension_dir_name) { | 43 const std::string& extension_dir_name) { |
33 base::FilePath extension_path; | 44 base::FilePath extension_path; |
34 std::string load_error; | 45 std::string load_error; |
35 PathService::Get(chrome::DIR_TEST_DATA, &extension_path); | 46 PathService::Get(chrome::DIR_TEST_DATA, &extension_path); |
36 extension_path = extension_path.AppendASCII("requirements_checker") | 47 extension_path = extension_path.AppendASCII("requirements_checker") |
37 .AppendASCII(extension_dir_name); | 48 .AppendASCII(extension_dir_name); |
38 scoped_refptr<const Extension> extension = | 49 scoped_refptr<const Extension> extension = |
39 extension_file_util::LoadExtension(extension_path, Manifest::UNPACKED, | 50 extension_file_util::LoadExtension(extension_path, Manifest::UNPACKED, |
40 0, &load_error); | 51 0, &load_error); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 scoped_refptr<const Extension> extension( | 183 scoped_refptr<const Extension> extension( |
173 LoadExtensionFromDirName("require_3d")); | 184 LoadExtensionFromDirName("require_3d")); |
174 ASSERT_TRUE(extension.get()); | 185 ASSERT_TRUE(extension.get()); |
175 | 186 |
176 checker_.Check(extension, base::Bind( | 187 checker_.Check(extension, base::Bind( |
177 &RequirementsCheckerBrowserTest::ValidateRequirementErrors, | 188 &RequirementsCheckerBrowserTest::ValidateRequirementErrors, |
178 base::Unretained(this), std::vector<std::string>())); | 189 base::Unretained(this), std::vector<std::string>())); |
179 content::BrowserThread::GetBlockingPool()->FlushForTesting(); | 190 content::BrowserThread::GetBlockingPool()->FlushForTesting(); |
180 } | 191 } |
181 | 192 |
182 } // namespace extensions | 193 } // extensions |
OLD | NEW |