OLD | NEW |
---|---|
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 "base/base_paths.h" | |
5 #include "base/bind.h" | 6 #include "base/bind.h" |
6 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/path_service.h" | |
7 #include "base/test/launcher/unit_test_launcher.h" | 9 #include "base/test/launcher/unit_test_launcher.h" |
8 #include "base/test/test_suite.h" | 10 #include "base/test/test_suite.h" |
11 #include "content/public/test/unittest_test_suite.h" | |
12 #include "extensions/common/extension_paths.h" | |
9 #include "extensions/test/test_extensions_client.h" | 13 #include "extensions/test/test_extensions_client.h" |
14 #include "ui/base/resource/resource_bundle.h" | |
10 | 15 |
11 namespace { | 16 namespace { |
12 | 17 |
13 class ExtensionsTestSuite : public base::TestSuite { | 18 class ExtensionsTestSuite : public base::TestSuite { |
14 public: | 19 public: |
15 ExtensionsTestSuite(int argc, char** argv); | 20 ExtensionsTestSuite(int argc, char** argv); |
16 | 21 |
17 private: | 22 private: |
18 // base::TestSuite: | 23 // base::TestSuite: |
19 virtual void Initialize() OVERRIDE; | 24 virtual void Initialize() OVERRIDE; |
20 virtual void Shutdown() OVERRIDE; | 25 virtual void Shutdown() OVERRIDE; |
21 | 26 |
22 scoped_ptr<extensions::TestExtensionsClient> client_; | 27 scoped_ptr<extensions::TestExtensionsClient> client_; |
23 | 28 |
24 DISALLOW_COPY_AND_ASSIGN(ExtensionsTestSuite); | 29 DISALLOW_COPY_AND_ASSIGN(ExtensionsTestSuite); |
25 }; | 30 }; |
26 | 31 |
27 ExtensionsTestSuite::ExtensionsTestSuite(int argc, char** argv) | 32 ExtensionsTestSuite::ExtensionsTestSuite(int argc, char** argv) |
28 : base::TestSuite(argc, argv) {} | 33 : base::TestSuite(argc, argv) {} |
29 | 34 |
30 void ExtensionsTestSuite::Initialize() { | 35 void ExtensionsTestSuite::Initialize() { |
31 base::TestSuite::Initialize(); | 36 base::TestSuite::Initialize(); |
32 | 37 |
38 extensions::RegisterPathProvider(); | |
tfarina
2014/07/23 02:29:44
are you sure you needed this? As far as I can see,
Sam McNally
2014/07/23 08:27:36
ModuleSystemTest uses extensions::DIR_TEST_DATA.
| |
39 | |
40 base::FilePath resources_pack_path; | |
41 PathService::Get(base::DIR_MODULE, &resources_pack_path); | |
42 ResourceBundle::InitSharedInstanceWithPakPath( | |
tfarina
2014/07/23 02:29:44
ui::ResourceBundle
| |
43 resources_pack_path.AppendASCII("extensions_unittests_resources.pak")); | |
44 | |
33 client_.reset(new extensions::TestExtensionsClient()); | 45 client_.reset(new extensions::TestExtensionsClient()); |
34 extensions::ExtensionsClient::Set(client_.get()); | 46 extensions::ExtensionsClient::Set(client_.get()); |
35 } | 47 } |
36 | 48 |
37 void ExtensionsTestSuite::Shutdown() { | 49 void ExtensionsTestSuite::Shutdown() { |
50 ResourceBundle::CleanupSharedInstance(); | |
tfarina
2014/07/23 02:29:44
ui::ResourceBundle
| |
38 base::TestSuite::Shutdown(); | 51 base::TestSuite::Shutdown(); |
39 } | 52 } |
40 | 53 |
41 } // namespace | 54 } // namespace |
42 | 55 |
43 int main(int argc, char** argv) { | 56 int main(int argc, char** argv) { |
44 ExtensionsTestSuite test_suite(argc, argv); | 57 content::UnitTestTestSuite test_suite(new ExtensionsTestSuite(argc, argv)); |
tfarina
2014/07/23 02:29:43
why content::UnitTestTestSuite here?
Sam McNally
2014/07/23 08:27:36
ModuleSystemTest expects v8 to be initialized and
| |
45 | 58 |
46 return base::LaunchUnitTests(argc, | 59 return base::LaunchUnitTests(argc, |
47 argv, | 60 argv, |
48 base::Bind(&ExtensionsTestSuite::Run, | 61 base::Bind(&content::UnitTestTestSuite::Run, |
49 base::Unretained(&test_suite))); | 62 base::Unretained(&test_suite))); |
50 } | 63 } |
OLD | NEW |