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

Side by Side Diff: extensions/test/extensions_unittests_main.cc

Issue 2574763003: Remove chrome-extension-resource:// scheme (Closed)
Patch Set: Remove BUILD reference to resources/extension outdir. Created 4 years 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
« no previous file with comments | « extensions/shell/common/shell_content_client.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <memory> 5 #include <memory>
6 6
7 #include "base/base_paths.h" 7 #include "base/base_paths.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/test/launcher/unit_test_launcher.h" 11 #include "base/test/launcher/unit_test_launcher.h"
12 #include "base/test/test_io_thread.h" 12 #include "base/test/test_io_thread.h"
13 #include "content/public/common/content_client.h" 13 #include "content/public/common/content_client.h"
14 #include "content/public/test/content_test_suite_base.h" 14 #include "content/public/test/content_test_suite_base.h"
15 #include "content/public/test/unittest_test_suite.h" 15 #include "content/public/test/unittest_test_suite.h"
16 #include "extensions/common/constants.h" 16 #include "extensions/common/constants.h"
17 #include "extensions/common/extension_paths.h" 17 #include "extensions/common/extension_paths.h"
18 #include "extensions/test/test_extensions_client.h" 18 #include "extensions/test/test_extensions_client.h"
19 #include "mojo/edk/test/scoped_ipc_support.h" 19 #include "mojo/edk/test/scoped_ipc_support.h"
20 #include "ui/base/resource/resource_bundle.h" 20 #include "ui/base/resource/resource_bundle.h"
21 #include "ui/gl/test/gl_surface_test_support.h" 21 #include "ui/gl/test/gl_surface_test_support.h"
22 #include "url/url_util.h" 22 #include "url/url_util.h"
23 23
24 namespace { 24 namespace {
25 25
26 const int kNumExtensionStandardURLSchemes = 2;
27 const url::SchemeWithType kExtensionStandardURLSchemes[
28 kNumExtensionStandardURLSchemes] = {
29 {extensions::kExtensionScheme, url::SCHEME_WITHOUT_PORT},
30 {extensions::kExtensionResourceScheme, url::SCHEME_WITHOUT_PORT},
31 };
32
33 // Content client that exists only to register chrome-extension:// scheme with 26 // Content client that exists only to register chrome-extension:// scheme with
34 // the url module. 27 // the url module.
35 // TODO(jamescook): Should this be merged with ShellContentClient? Should this 28 // TODO(jamescook): Should this be merged with ShellContentClient? Should this
36 // be a persistent object available to tests? 29 // be a persistent object available to tests?
37 class ExtensionsContentClient : public content::ContentClient { 30 class ExtensionsContentClient : public content::ContentClient {
38 public: 31 public:
39 ExtensionsContentClient() {} 32 ExtensionsContentClient() {}
40 ~ExtensionsContentClient() override {} 33 ~ExtensionsContentClient() override {}
41 34
42 // content::ContentClient overrides: 35 // content::ContentClient overrides:
43 void AddAdditionalSchemes( 36 void AddAdditionalSchemes(
44 std::vector<url::SchemeWithType>* standard_schemes, 37 std::vector<url::SchemeWithType>* standard_schemes,
45 std::vector<url::SchemeWithType>* referrer_schemes, 38 std::vector<url::SchemeWithType>* referrer_schemes,
46 std::vector<std::string>* savable_schemes) override { 39 std::vector<std::string>* savable_schemes) override {
47 for (int i = 0; i < kNumExtensionStandardURLSchemes; i++) 40 standard_schemes->push_back(url::SchemeWithType{
48 standard_schemes->push_back(kExtensionStandardURLSchemes[i]); 41 extensions::kExtensionScheme, url::SCHEME_WITHOUT_PORT});
49
50 savable_schemes->push_back(extensions::kExtensionScheme); 42 savable_schemes->push_back(extensions::kExtensionScheme);
51 savable_schemes->push_back(extensions::kExtensionResourceScheme);
52 } 43 }
53 44
54 private: 45 private:
55 DISALLOW_COPY_AND_ASSIGN(ExtensionsContentClient); 46 DISALLOW_COPY_AND_ASSIGN(ExtensionsContentClient);
56 }; 47 };
57 48
58 // The test suite for extensions_unittests. 49 // The test suite for extensions_unittests.
59 class ExtensionsTestSuite : public content::ContentTestSuiteBase { 50 class ExtensionsTestSuite : public content::ContentTestSuiteBase {
60 public: 51 public:
61 ExtensionsTestSuite(int argc, char** argv); 52 ExtensionsTestSuite(int argc, char** argv);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 content::UnitTestTestSuite test_suite(new ExtensionsTestSuite(argc, argv)); 106 content::UnitTestTestSuite test_suite(new ExtensionsTestSuite(argc, argv));
116 107
117 base::TestIOThread test_io_thread(base::TestIOThread::kAutoStart); 108 base::TestIOThread test_io_thread(base::TestIOThread::kAutoStart);
118 mojo::edk::test::ScopedIPCSupport ipc_support(test_io_thread.task_runner()); 109 mojo::edk::test::ScopedIPCSupport ipc_support(test_io_thread.task_runner());
119 110
120 return base::LaunchUnitTests(argc, 111 return base::LaunchUnitTests(argc,
121 argv, 112 argv,
122 base::Bind(&content::UnitTestTestSuite::Run, 113 base::Bind(&content::UnitTestTestSuite::Run,
123 base::Unretained(&test_suite))); 114 base::Unretained(&test_suite)));
124 } 115 }
OLDNEW
« no previous file with comments | « extensions/shell/common/shell_content_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698