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" | |
21 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
22 #include "content/public/browser/gpu_data_manager.h" | 21 #include "content/public/browser/gpu_data_manager.h" |
23 #include "gpu/config/gpu_info.h" | 22 #include "gpu/config/gpu_info.h" |
24 #include "grit/generated_resources.h" | 23 #include "grit/generated_resources.h" |
25 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
26 #include "ui/gl/gl_switches.h" | 25 #include "ui/gl/gl_switches.h" |
27 | 26 |
28 namespace extensions { | 27 namespace extensions { |
29 | 28 |
30 class RequirementsCheckerBrowserTest : public ExtensionBrowserTest { | 29 class RequirementsCheckerBrowserTest : public ExtensionBrowserTest { |
31 public: | 30 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 | |
42 scoped_refptr<const Extension> LoadExtensionFromDirName( | 31 scoped_refptr<const Extension> LoadExtensionFromDirName( |
43 const std::string& extension_dir_name) { | 32 const std::string& extension_dir_name) { |
44 base::FilePath extension_path; | 33 base::FilePath extension_path; |
45 std::string load_error; | 34 std::string load_error; |
46 PathService::Get(chrome::DIR_TEST_DATA, &extension_path); | 35 PathService::Get(chrome::DIR_TEST_DATA, &extension_path); |
47 extension_path = extension_path.AppendASCII("requirements_checker") | 36 extension_path = extension_path.AppendASCII("requirements_checker") |
48 .AppendASCII(extension_dir_name); | 37 .AppendASCII(extension_dir_name); |
49 scoped_refptr<const Extension> extension = | 38 scoped_refptr<const Extension> extension = |
50 extension_file_util::LoadExtension(extension_path, Manifest::UNPACKED, | 39 extension_file_util::LoadExtension(extension_path, Manifest::UNPACKED, |
51 0, &load_error); | 40 0, &load_error); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 scoped_refptr<const Extension> extension( | 172 scoped_refptr<const Extension> extension( |
184 LoadExtensionFromDirName("require_3d")); | 173 LoadExtensionFromDirName("require_3d")); |
185 ASSERT_TRUE(extension.get()); | 174 ASSERT_TRUE(extension.get()); |
186 | 175 |
187 checker_.Check(extension, base::Bind( | 176 checker_.Check(extension, base::Bind( |
188 &RequirementsCheckerBrowserTest::ValidateRequirementErrors, | 177 &RequirementsCheckerBrowserTest::ValidateRequirementErrors, |
189 base::Unretained(this), std::vector<std::string>())); | 178 base::Unretained(this), std::vector<std::string>())); |
190 content::BrowserThread::GetBlockingPool()->FlushForTesting(); | 179 content::BrowserThread::GetBlockingPool()->FlushForTesting(); |
191 } | 180 } |
192 | 181 |
193 } // extensions | 182 } // namespace extensions |
OLD | NEW |