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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/metrics/statistics_recorder.h" | 7 #include "base/metrics/statistics_recorder.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 "base/test/test_suite.h" | 10 #include "base/test/test_suite.h" |
11 #include "components/content_settings/core/common/content_settings_pattern.h" | |
11 #include "content/public/test/test_content_client_initializer.h" | 12 #include "content/public/test/test_content_client_initializer.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "ui/base/resource/resource_bundle.h" | 14 #include "ui/base/resource/resource_bundle.h" |
14 #include "ui/base/ui_base_paths.h" | 15 #include "ui/base/ui_base_paths.h" |
16 #include "url/url_util.h" | |
15 | 17 |
16 #if defined(OS_MACOSX) | 18 #if defined(OS_MACOSX) |
17 #include "base/mac/bundle_locations.h" | 19 #include "base/mac/bundle_locations.h" |
18 #endif | 20 #endif |
19 | 21 |
20 #if !defined(OS_IOS) | 22 #if !defined(OS_IOS) |
21 #include "ui/gl/gl_surface.h" | 23 #include "ui/gl/gl_surface.h" |
22 #endif | 24 #endif |
23 | 25 |
24 #if defined(OS_ANDROID) | 26 #if defined(OS_ANDROID) |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
76 | 78 |
77 // TODO(tfarina): This should be changed to InitSharedInstanceWithPakFile() | 79 // TODO(tfarina): This should be changed to InitSharedInstanceWithPakFile() |
78 // so we can load our pak file instead of chrome.pak. crbug.com/348563 | 80 // so we can load our pak file instead of chrome.pak. crbug.com/348563 |
79 ui::ResourceBundle::InitSharedInstanceWithLocale( | 81 ui::ResourceBundle::InitSharedInstanceWithLocale( |
80 "en-US", NULL, ui::ResourceBundle::LOAD_COMMON_RESOURCES); | 82 "en-US", NULL, ui::ResourceBundle::LOAD_COMMON_RESOURCES); |
81 base::FilePath resources_pack_path; | 83 base::FilePath resources_pack_path; |
82 PathService::Get(base::DIR_MODULE, &resources_pack_path); | 84 PathService::Get(base::DIR_MODULE, &resources_pack_path); |
83 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( | 85 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( |
84 resources_pack_path.AppendASCII("resources.pak"), | 86 resources_pack_path.AppendASCII("resources.pak"), |
85 ui::SCALE_FACTOR_NONE); | 87 ui::SCALE_FACTOR_NONE); |
88 | |
89 // These schemes need to be added globally to pass tests of | |
90 // autocomplete_input_unittest.cc and content_settings_pattern* | |
91 url::AddStandardScheme("chrome"); | |
jochen (gone - plz use gerrit)
2014/09/08 11:11:12
why does the content_settings_pattern* test need t
Jun Mukai
2014/09/08 16:56:05
They appear as test expectations.
Indeed component
| |
92 url::AddStandardScheme("chrome-extension"); | |
93 url::AddStandardScheme("chrome-devtools"); | |
94 url::AddStandardScheme("chrome-search"); | |
95 | |
96 // Not using kExtensionScheme to avoid the dependency to extensions. | |
97 ContentSettingsPattern::SetNonWildcardDomainNonPortScheme( | |
98 "chrome-extension"); | |
86 } | 99 } |
87 | 100 |
88 virtual void Shutdown() OVERRIDE { | 101 virtual void Shutdown() OVERRIDE { |
89 ui::ResourceBundle::CleanupSharedInstance(); | 102 ui::ResourceBundle::CleanupSharedInstance(); |
90 | 103 |
91 #if defined(OS_MACOSX) && !defined(OS_IOS) | 104 #if defined(OS_MACOSX) && !defined(OS_IOS) |
92 base::mac::SetOverrideFrameworkBundle(NULL); | 105 base::mac::SetOverrideFrameworkBundle(NULL); |
93 #endif | 106 #endif |
94 | 107 |
95 base::TestSuite::Shutdown(); | 108 base::TestSuite::Shutdown(); |
(...skipping 29 matching lines...) Expand all Loading... | |
125 // The listener will set up common test environment for all components unit | 138 // The listener will set up common test environment for all components unit |
126 // tests. | 139 // tests. |
127 testing::TestEventListeners& listeners = | 140 testing::TestEventListeners& listeners = |
128 testing::UnitTest::GetInstance()->listeners(); | 141 testing::UnitTest::GetInstance()->listeners(); |
129 listeners.Append(new ComponentsUnitTestEventListener()); | 142 listeners.Append(new ComponentsUnitTestEventListener()); |
130 | 143 |
131 return base::LaunchUnitTests( | 144 return base::LaunchUnitTests( |
132 argc, argv, base::Bind(&base::TestSuite::Run, | 145 argc, argv, base::Bind(&base::TestSuite::Run, |
133 base::Unretained(&test_suite))); | 146 base::Unretained(&test_suite))); |
134 } | 147 } |
OLD | NEW |