| 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 |
| 11 #if defined(OS_MACOSX) | 11 #if defined(OS_MACOSX) |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/mac/bundle_locations.h" | 13 #include "base/mac/bundle_locations.h" |
| 14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
| 15 #include "base/test/mock_chrome_application_mac.h" | 15 #include "base/test/mock_chrome_application_mac.h" |
| 16 #include "ui/base/material_design/material_design_controller.h" | |
| 17 #include "ui/base/resource/resource_bundle.h" | 16 #include "ui/base/resource/resource_bundle.h" |
| 18 #endif | 17 #endif |
| 19 | 18 |
| 20 namespace { | 19 namespace { |
| 21 | 20 |
| 22 class ShellDialogsTestSuite : public base::TestSuite { | 21 class ShellDialogsTestSuite : public base::TestSuite { |
| 23 public: | 22 public: |
| 24 ShellDialogsTestSuite(int argc, char** argv); | 23 ShellDialogsTestSuite(int argc, char** argv); |
| 25 | 24 |
| 26 protected: | 25 protected: |
| (...skipping 16 matching lines...) Expand all Loading... |
| 43 | 42 |
| 44 // Set up framework bundle so that tests on Mac can access nib files. | 43 // Set up framework bundle so that tests on Mac can access nib files. |
| 45 base::FilePath path; | 44 base::FilePath path; |
| 46 PathService::Get(base::DIR_EXE, &path); | 45 PathService::Get(base::DIR_EXE, &path); |
| 47 // The three DirName() calls strip "Contents/MacOS/<binary>" from the path. | 46 // The three DirName() calls strip "Contents/MacOS/<binary>" from the path. |
| 48 path = path.DirName().DirName().DirName(); | 47 path = path.DirName().DirName().DirName(); |
| 49 path = path.Append(FILE_PATH_LITERAL("shell_dialogs_unittests.app")); | 48 path = path.Append(FILE_PATH_LITERAL("shell_dialogs_unittests.app")); |
| 50 base::mac::SetOverrideFrameworkBundlePath(path); | 49 base::mac::SetOverrideFrameworkBundlePath(path); |
| 51 | 50 |
| 52 // Setup resource bundle. | 51 // Setup resource bundle. |
| 53 ui::MaterialDesignController::Initialize(); | |
| 54 ui::ResourceBundle::InitSharedInstanceWithLocale( | 52 ui::ResourceBundle::InitSharedInstanceWithLocale( |
| 55 "en-US", nullptr, ui::ResourceBundle::LOAD_COMMON_RESOURCES); | 53 "en-US", nullptr, ui::ResourceBundle::LOAD_COMMON_RESOURCES); |
| 56 #endif | 54 #endif |
| 57 } | 55 } |
| 58 | 56 |
| 59 void ShellDialogsTestSuite::Shutdown() { | 57 void ShellDialogsTestSuite::Shutdown() { |
| 60 #if defined(OS_MACOSX) | 58 #if defined(OS_MACOSX) |
| 61 ui::ResourceBundle::CleanupSharedInstance(); | 59 ui::ResourceBundle::CleanupSharedInstance(); |
| 62 base::mac::SetOverrideFrameworkBundle(NULL); | 60 base::mac::SetOverrideFrameworkBundle(NULL); |
| 63 #endif | 61 #endif |
| 64 base::TestSuite::Shutdown(); | 62 base::TestSuite::Shutdown(); |
| 65 } | 63 } |
| 66 | 64 |
| 67 } // namespace | 65 } // namespace |
| 68 | 66 |
| 69 int main(int argc, char** argv) { | 67 int main(int argc, char** argv) { |
| 70 ShellDialogsTestSuite test_suite(argc, argv); | 68 ShellDialogsTestSuite test_suite(argc, argv); |
| 71 | 69 |
| 72 return base::LaunchUnitTests( | 70 return base::LaunchUnitTests( |
| 73 argc, argv, | 71 argc, argv, |
| 74 base::Bind(&ShellDialogsTestSuite::Run, base::Unretained(&test_suite))); | 72 base::Bind(&ShellDialogsTestSuite::Run, base::Unretained(&test_suite))); |
| 75 } | 73 } |
| OLD | NEW |