Chromium Code Reviews| 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/base_paths.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/test/launcher/unit_test_launcher.h" | 9 #include "base/test/launcher/unit_test_launcher.h" |
| 10 #include "content/public/common/content_client.h" | 10 #include "content/public/common/content_client.h" |
| 11 #include "content/public/test/content_test_suite_base.h" | 11 #include "content/public/test/content_test_suite_base.h" |
| 12 #include "content/public/test/unittest_test_suite.h" | 12 #include "content/public/test/unittest_test_suite.h" |
| 13 #include "extensions/common/constants.h" | 13 #include "extensions/common/constants.h" |
| 14 #include "extensions/common/extension_paths.h" | 14 #include "extensions/common/extension_paths.h" |
| 15 #include "extensions/test/test_extensions_client.h" | 15 #include "extensions/test/test_extensions_client.h" |
| 16 #include "mojo/embedder/embedder.h" | 16 #include "mojo/embedder/embedder.h" |
| 17 #include "ui/base/resource/resource_bundle.h" | 17 #include "ui/base/resource/resource_bundle.h" |
| 18 | 18 |
| 19 #if !defined(OS_IOS) | |
| 20 #include "ui/gl/gl_surface.h" | |
| 21 #endif | |
| 22 | |
| 19 namespace { | 23 namespace { |
| 20 | 24 |
| 21 // Content client that exists only to register chrome-extension:// scheme with | 25 // Content client that exists only to register chrome-extension:// scheme with |
| 22 // the url module. | 26 // the url module. |
| 23 // TODO(jamescook): Should this be merged with ShellContentClient? Should this | 27 // TODO(jamescook): Should this be merged with ShellContentClient? Should this |
| 24 // be a persistent object available to tests? | 28 // be a persistent object available to tests? |
| 25 class ExtensionsContentClient : public content::ContentClient { | 29 class ExtensionsContentClient : public content::ContentClient { |
| 26 public: | 30 public: |
| 27 ExtensionsContentClient() {} | 31 ExtensionsContentClient() {} |
| 28 virtual ~ExtensionsContentClient() {} | 32 virtual ~ExtensionsContentClient() {} |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 58 }; | 62 }; |
| 59 | 63 |
| 60 ExtensionsTestSuite::ExtensionsTestSuite(int argc, char** argv) | 64 ExtensionsTestSuite::ExtensionsTestSuite(int argc, char** argv) |
| 61 : content::ContentTestSuiteBase(argc, argv) {} | 65 : content::ContentTestSuiteBase(argc, argv) {} |
| 62 | 66 |
| 63 ExtensionsTestSuite::~ExtensionsTestSuite() {} | 67 ExtensionsTestSuite::~ExtensionsTestSuite() {} |
| 64 | 68 |
| 65 void ExtensionsTestSuite::Initialize() { | 69 void ExtensionsTestSuite::Initialize() { |
| 66 content::ContentTestSuiteBase::Initialize(); | 70 content::ContentTestSuiteBase::Initialize(); |
| 67 | 71 |
| 72 #if !defined(OS_IOS) | |
| 73 gfx::GLSurface::InitializeOneOffForTests(); | |
|
James Cook
2014/08/13 16:11:36
We need a GL surface for this test? Why?
In theo
Yoyo Zhou
2014/08/13 22:53:43
It turns out I don't need it after all. I recall t
| |
| 74 #endif | |
| 75 | |
| 68 // Register the chrome-extension:// scheme via this circuitous path. Note | 76 // Register the chrome-extension:// scheme via this circuitous path. Note |
| 69 // that this does not persistently set up a ContentClient; individual tests | 77 // that this does not persistently set up a ContentClient; individual tests |
| 70 // must use content::SetContentClient(). | 78 // must use content::SetContentClient(). |
| 71 { | 79 { |
| 72 ExtensionsContentClient content_client; | 80 ExtensionsContentClient content_client; |
| 73 RegisterContentSchemes(&content_client); | 81 RegisterContentSchemes(&content_client); |
| 74 } | 82 } |
| 75 | 83 |
| 76 extensions::RegisterPathProvider(); | 84 extensions::RegisterPathProvider(); |
| 77 | 85 |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 97 | 105 |
| 98 int main(int argc, char** argv) { | 106 int main(int argc, char** argv) { |
| 99 content::UnitTestTestSuite test_suite(new ExtensionsTestSuite(argc, argv)); | 107 content::UnitTestTestSuite test_suite(new ExtensionsTestSuite(argc, argv)); |
| 100 | 108 |
| 101 mojo::embedder::Init(); | 109 mojo::embedder::Init(); |
| 102 return base::LaunchUnitTests(argc, | 110 return base::LaunchUnitTests(argc, |
| 103 argv, | 111 argv, |
| 104 base::Bind(&content::UnitTestTestSuite::Run, | 112 base::Bind(&content::UnitTestTestSuite::Run, |
| 105 base::Unretained(&test_suite))); | 113 base::Unretained(&test_suite))); |
| 106 } | 114 } |
| OLD | NEW |