Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: chrome/browser/extensions/requirements_checker_browsertest.cc

Issue 236213002: Move most of extension_file_util.cc into extensions/common/file_util.cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase (file-util) Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_file_util.h"
19 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
20 #include "content/public/browser/gpu_data_manager.h" 19 #include "content/public/browser/gpu_data_manager.h"
21 #include "extensions/common/extension.h" 20 #include "extensions/common/extension.h"
21 #include "extensions/common/file_util.h"
22 #include "gpu/config/gpu_info.h" 22 #include "gpu/config/gpu_info.h"
23 #include "grit/generated_resources.h" 23 #include "grit/generated_resources.h"
24 #include "ui/base/l10n/l10n_util.h" 24 #include "ui/base/l10n/l10n_util.h"
25 #include "ui/gl/gl_switches.h" 25 #include "ui/gl/gl_switches.h"
26 26
27 namespace extensions { 27 namespace extensions {
28 28
29 class RequirementsCheckerBrowserTest : public ExtensionBrowserTest { 29 class RequirementsCheckerBrowserTest : public ExtensionBrowserTest {
30 public: 30 public:
31 scoped_refptr<const Extension> LoadExtensionFromDirName( 31 scoped_refptr<const Extension> LoadExtensionFromDirName(
32 const std::string& extension_dir_name) { 32 const std::string& extension_dir_name) {
33 base::FilePath extension_path; 33 base::FilePath extension_path;
34 std::string load_error; 34 std::string load_error;
35 PathService::Get(chrome::DIR_TEST_DATA, &extension_path); 35 PathService::Get(chrome::DIR_TEST_DATA, &extension_path);
36 extension_path = extension_path.AppendASCII("requirements_checker") 36 extension_path = extension_path.AppendASCII("requirements_checker")
37 .AppendASCII(extension_dir_name); 37 .AppendASCII(extension_dir_name);
38 scoped_refptr<const Extension> extension = 38 scoped_refptr<const Extension> extension = file_util::LoadExtension(
39 extension_file_util::LoadExtension(extension_path, Manifest::UNPACKED, 39 extension_path, Manifest::UNPACKED, 0, &load_error);
40 0, &load_error);
41 CHECK(load_error.length() == 0u); 40 CHECK(load_error.length() == 0u);
42 return extension; 41 return extension;
43 } 42 }
44 43
45 void ValidateRequirementErrors(std::vector<std::string> expected_errors, 44 void ValidateRequirementErrors(std::vector<std::string> expected_errors,
46 std::vector<std::string> actual_errors) { 45 std::vector<std::string> actual_errors) {
47 ASSERT_EQ(expected_errors, actual_errors); 46 ASSERT_EQ(expected_errors, actual_errors);
48 requirement_errors_.swap(actual_errors); 47 requirement_errors_.swap(actual_errors);
49 } 48 }
50 49
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 IDS_EXTENSION_CSS3D_NOT_SUPPORTED)); 198 IDS_EXTENSION_CSS3D_NOT_SUPPORTED));
200 } 199 }
201 200
202 checker_.Check(extension, base::Bind( 201 checker_.Check(extension, base::Bind(
203 &RequirementsCheckerBrowserTest::ValidateRequirementErrors, 202 &RequirementsCheckerBrowserTest::ValidateRequirementErrors,
204 base::Unretained(this), expected_errors)); 203 base::Unretained(this), expected_errors));
205 content::BrowserThread::GetBlockingPool()->FlushForTesting(); 204 content::BrowserThread::GetBlockingPool()->FlushForTesting();
206 } 205 }
207 206
208 } // namespace extensions 207 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698