| 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/files/file_path.h" | 6 #include "base/files/file_path.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/metrics/statistics_recorder.h" | 8 #include "base/metrics/statistics_recorder.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/test/launcher/unit_test_launcher.h" | 10 #include "base/test/launcher/unit_test_launcher.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 #endif | 54 #endif |
| 55 | 55 |
| 56 ui::RegisterPathProvider(); | 56 ui::RegisterPathProvider(); |
| 57 | 57 |
| 58 base::FilePath pak_path; | 58 base::FilePath pak_path; |
| 59 #if defined(OS_ANDROID) | 59 #if defined(OS_ANDROID) |
| 60 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &pak_path); | 60 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &pak_path); |
| 61 #else | 61 #else |
| 62 PathService::Get(base::DIR_MODULE, &pak_path); | 62 PathService::Get(base::DIR_MODULE, &pak_path); |
| 63 #endif | 63 #endif |
| 64 |
| 65 #if defined(OS_IOS) || defined(OS_ANDROID) |
| 64 ui::ResourceBundle::InitSharedInstanceWithPakPath( | 66 ui::ResourceBundle::InitSharedInstanceWithPakPath( |
| 65 pak_path.AppendASCII("components_tests_resources.pak")); | 67 pak_path.AppendASCII("components_tests_resources.pak")); |
| 68 #else |
| 69 base::FilePath ui_test_pak_path; |
| 70 ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path)); |
| 71 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); |
| 72 |
| 73 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( |
| 74 pak_path.AppendASCII("components_tests_resources.pak"), |
| 75 ui::SCALE_FACTOR_NONE); |
| 76 #endif |
| 66 | 77 |
| 67 // These schemes need to be added globally to pass tests of | 78 // These schemes need to be added globally to pass tests of |
| 68 // autocomplete_input_unittest.cc and content_settings_pattern* | 79 // autocomplete_input_unittest.cc and content_settings_pattern* |
| 69 url::AddStandardScheme("chrome"); | 80 url::AddStandardScheme("chrome"); |
| 70 url::AddStandardScheme("chrome-extension"); | 81 url::AddStandardScheme("chrome-extension"); |
| 71 url::AddStandardScheme("chrome-devtools"); | 82 url::AddStandardScheme("chrome-devtools"); |
| 72 url::AddStandardScheme("chrome-search"); | 83 url::AddStandardScheme("chrome-search"); |
| 73 | 84 |
| 74 // Not using kExtensionScheme to avoid the dependency to extensions. | 85 // Not using kExtensionScheme to avoid the dependency to extensions. |
| 75 ContentSettingsPattern::SetNonWildcardDomainNonPortScheme( | 86 ContentSettingsPattern::SetNonWildcardDomainNonPortScheme( |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 // The listener will set up common test environment for all components unit | 123 // The listener will set up common test environment for all components unit |
| 113 // tests. | 124 // tests. |
| 114 testing::TestEventListeners& listeners = | 125 testing::TestEventListeners& listeners = |
| 115 testing::UnitTest::GetInstance()->listeners(); | 126 testing::UnitTest::GetInstance()->listeners(); |
| 116 listeners.Append(new ComponentsUnitTestEventListener()); | 127 listeners.Append(new ComponentsUnitTestEventListener()); |
| 117 | 128 |
| 118 return base::LaunchUnitTests( | 129 return base::LaunchUnitTests( |
| 119 argc, argv, base::Bind(&base::TestSuite::Run, | 130 argc, argv, base::Bind(&base::TestSuite::Run, |
| 120 base::Unretained(&test_suite))); | 131 base::Unretained(&test_suite))); |
| 121 } | 132 } |
| OLD | NEW |