Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ui / message_center / test / run_all_unittests.cc
blobcdf8b4fe8ee701c9b0921c1b886fbf3244a50afa
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
3 // found in the LICENSE file.
5 #include "base/basictypes.h"
6 #include "base/bind.h"
7 #include "base/compiler_specific.h"
8 #include "base/path_service.h"
9 #include "base/test/launcher/unit_test_launcher.h"
10 #include "base/test/test_discardable_memory_allocator.h"
11 #include "base/test/test_suite.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13 #include "ui/base/resource/resource_bundle.h"
14 #include "ui/base/ui_base_paths.h"
16 #if defined(OS_MACOSX)
17 #include "base/test/mock_chrome_application_mac.h"
18 #else
19 #include "ui/gl/test/gl_surface_test_support.h"
20 #endif
22 namespace {
24 class MessageCenterTestSuite : public base::TestSuite {
25 public:
26 MessageCenterTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {}
28 protected:
29 void Initialize() override {
30 #if defined(OS_MACOSX)
31 mock_cr_app::RegisterMockCrApp();
32 #else
33 gfx::GLSurfaceTestSupport::InitializeOneOff();
34 #endif
35 base::TestSuite::Initialize();
36 ui::RegisterPathProvider();
38 base::FilePath ui_test_pak_path;
39 ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path));
40 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path);
42 base::DiscardableMemoryAllocator::SetInstance(
43 &discardable_memory_allocator_);
46 void Shutdown() override {
47 ui::ResourceBundle::CleanupSharedInstance();
48 base::TestSuite::Shutdown();
51 private:
52 base::TestDiscardableMemoryAllocator discardable_memory_allocator_;
54 DISALLOW_COPY_AND_ASSIGN(MessageCenterTestSuite);
57 } // namespace
59 int main(int argc, char** argv) {
60 MessageCenterTestSuite test_suite(argc, argv);
62 return base::LaunchUnitTests(
63 argc,
64 argv,
65 base::Bind(&MessageCenterTestSuite::Run, base::Unretained(&test_suite)));