| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/macros.h" | 6 #include "base/macros.h" |
| 7 #include "base/test/launcher/unit_test_launcher.h" | 7 #include "base/test/launcher/unit_test_launcher.h" |
| 8 #include "base/test/test_suite.h" | 8 #include "base/test/test_suite.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 ShellDialogsTestSuite::ShellDialogsTestSuite(int argc, char** argv) | 35 ShellDialogsTestSuite::ShellDialogsTestSuite(int argc, char** argv) |
| 36 : base::TestSuite(argc, argv) {} | 36 : base::TestSuite(argc, argv) {} |
| 37 | 37 |
| 38 void ShellDialogsTestSuite::Initialize() { | 38 void ShellDialogsTestSuite::Initialize() { |
| 39 base::TestSuite::Initialize(); | 39 base::TestSuite::Initialize(); |
| 40 | 40 |
| 41 #if defined(OS_MACOSX) | 41 #if defined(OS_MACOSX) |
| 42 mock_cr_app::RegisterMockCrApp(); | 42 mock_cr_app::RegisterMockCrApp(); |
| 43 | 43 |
| 44 // Set up framework bundle so that tests on Mac can access nib files. | |
| 45 base::FilePath path; | |
| 46 PathService::Get(base::DIR_EXE, &path); | |
| 47 // The three DirName() calls strip "Contents/MacOS/<binary>" from the path. | |
| 48 path = path.DirName().DirName().DirName(); | |
| 49 path = path.Append(FILE_PATH_LITERAL("shell_dialogs_unittests.app")); | |
| 50 base::mac::SetOverrideFrameworkBundlePath(path); | |
| 51 | |
| 52 // Setup resource bundle. | 44 // Setup resource bundle. |
| 53 ui::MaterialDesignController::Initialize(); | 45 ui::MaterialDesignController::Initialize(); |
| 54 ui::ResourceBundle::InitSharedInstanceWithLocale( | 46 ui::ResourceBundle::InitSharedInstanceWithLocale( |
| 55 "en-US", nullptr, ui::ResourceBundle::LOAD_COMMON_RESOURCES); | 47 "en-US", nullptr, ui::ResourceBundle::LOAD_COMMON_RESOURCES); |
| 56 #endif | 48 #endif |
| 57 } | 49 } |
| 58 | 50 |
| 59 void ShellDialogsTestSuite::Shutdown() { | 51 void ShellDialogsTestSuite::Shutdown() { |
| 60 #if defined(OS_MACOSX) | 52 #if defined(OS_MACOSX) |
| 61 ui::ResourceBundle::CleanupSharedInstance(); | 53 ui::ResourceBundle::CleanupSharedInstance(); |
| 62 base::mac::SetOverrideFrameworkBundle(NULL); | |
| 63 #endif | 54 #endif |
| 64 base::TestSuite::Shutdown(); | 55 base::TestSuite::Shutdown(); |
| 65 } | 56 } |
| 66 | 57 |
| 67 } // namespace | 58 } // namespace |
| 68 | 59 |
| 69 int main(int argc, char** argv) { | 60 int main(int argc, char** argv) { |
| 70 ShellDialogsTestSuite test_suite(argc, argv); | 61 ShellDialogsTestSuite test_suite(argc, argv); |
| 71 | 62 |
| 72 return base::LaunchUnitTests( | 63 return base::LaunchUnitTests( |
| 73 argc, argv, | 64 argc, argv, |
| 74 base::Bind(&ShellDialogsTestSuite::Run, base::Unretained(&test_suite))); | 65 base::Bind(&ShellDialogsTestSuite::Run, base::Unretained(&test_suite))); |
| 75 } | 66 } |
| OLD | NEW |