Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: components/test/run_all_unittests.cc

Issue 172473002: Move many of the Autofill unittests into components_unittests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/test/DEPS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/path_service.h"
7 #include "base/test/launcher/unit_test_launcher.h" 8 #include "base/test/launcher/unit_test_launcher.h"
8 #include "base/test/test_suite.h" 9 #include "base/test/test_suite.h"
9 #include "content/public/test/test_content_client_initializer.h" 10 #include "content/public/test/test_content_client_initializer.h"
10 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
11 #include "ui/base/resource/resource_bundle.h" 12 #include "ui/base/resource/resource_bundle.h"
13 #include "ui/base/ui_base_paths.h"
14
15 #if defined(OS_MACOSX)
16 #include "base/mac/bundle_locations.h"
17
18 // TODO(blundell): Eliminate this dependency by having this file avoid using
19 // the //chrome constant to get the framework name on OS X. crbug.com/348563
20 #include "chrome/common/chrome_constants.h"
21 #endif
12 22
13 #if !defined(OS_IOS) 23 #if !defined(OS_IOS)
14 #include "ui/gl/gl_surface.h" 24 #include "ui/gl/gl_surface.h"
15 #endif 25 #endif
16 26
17 #if defined(OS_ANDROID) 27 #if defined(OS_ANDROID)
18 #include "base/android/jni_android.h" 28 #include "base/android/jni_android.h"
19 #include "ui/base/android/ui_base_jni_registrar.h" 29 #include "ui/base/android/ui_base_jni_registrar.h"
20 #include "ui/gfx/android/gfx_jni_registrar.h" 30 #include "ui/gfx/android/gfx_jni_registrar.h"
21 #endif 31 #endif
(...skipping 10 matching lines...) Expand all
32 #if !defined(OS_IOS) 42 #if !defined(OS_IOS)
33 gfx::GLSurface::InitializeOneOffForTests(true); 43 gfx::GLSurface::InitializeOneOffForTests(true);
34 #endif 44 #endif
35 #if defined(OS_ANDROID) 45 #if defined(OS_ANDROID)
36 // Register JNI bindings for android. 46 // Register JNI bindings for android.
37 JNIEnv* env = base::android::AttachCurrentThread(); 47 JNIEnv* env = base::android::AttachCurrentThread();
38 gfx::android::RegisterJni(env); 48 gfx::android::RegisterJni(env);
39 ui::android::RegisterJni(env); 49 ui::android::RegisterJni(env);
40 #endif 50 #endif
41 51
52 #if defined(OS_MACOSX) && !defined(OS_IOS)
53 // Look in the framework bundle for resources.
54 base::FilePath path;
55 PathService::Get(base::DIR_EXE, &path);
tfarina 2014/03/05 18:28:22 tiny-nit: I'd name this exe_path.
56
57 // TODO(blundell): Eliminate this dependency by having this file avoid using
58 // the //chrome constant to get the framework name on OS X. crbug.com/348563
59 path = path.Append(chrome::kFrameworkName);
60 base::mac::SetOverrideFrameworkBundlePath(path);
tfarina 2014/03/05 18:28:22 nit: base::mac::SetOverrideFrameworkBundlePath(
61 #endif
62
63 ui::RegisterPathProvider();
tfarina 2014/03/05 18:28:22 this is to register ui::DIR_LOCALES, ui::DIR_TEST_
64
42 // TODO(tfarina): This should be changed to InitSharedInstanceWithPakFile() 65 // TODO(tfarina): This should be changed to InitSharedInstanceWithPakFile()
43 // so we can load our pak file instead of chrome.pak. 66 // so we can load our pak file instead of chrome.pak. crbug.com/348563
44 ui::ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL); 67 ui::ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL);
68 base::FilePath resources_pack_path;
69 PathService::Get(base::DIR_MODULE, &resources_pack_path);
70 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
71 resources_pack_path.AppendASCII("resources.pak"),
72 ui::SCALE_FACTOR_NONE);
45 } 73 }
46 74
47 virtual void Shutdown() OVERRIDE { 75 virtual void Shutdown() OVERRIDE {
48 ui::ResourceBundle::CleanupSharedInstance(); 76 ui::ResourceBundle::CleanupSharedInstance();
49 base::TestSuite::Shutdown(); 77 base::TestSuite::Shutdown();
tfarina 2014/03/05 18:28:22 you also need to add the following here: #if defi
50 } 78 }
51 79
52 DISALLOW_COPY_AND_ASSIGN(ComponentsTestSuite); 80 DISALLOW_COPY_AND_ASSIGN(ComponentsTestSuite);
53 }; 81 };
54 82
55 class ComponentsUnitTestEventListener : public testing::EmptyTestEventListener { 83 class ComponentsUnitTestEventListener : public testing::EmptyTestEventListener {
56 public: 84 public:
57 ComponentsUnitTestEventListener() {} 85 ComponentsUnitTestEventListener() {}
58 virtual ~ComponentsUnitTestEventListener() {} 86 virtual ~ComponentsUnitTestEventListener() {}
59 87
(...skipping 19 matching lines...) Expand all
79 // The listener will set up common test environment for all components unit 107 // The listener will set up common test environment for all components unit
80 // tests. 108 // tests.
81 testing::TestEventListeners& listeners = 109 testing::TestEventListeners& listeners =
82 testing::UnitTest::GetInstance()->listeners(); 110 testing::UnitTest::GetInstance()->listeners();
83 listeners.Append(new ComponentsUnitTestEventListener()); 111 listeners.Append(new ComponentsUnitTestEventListener());
84 112
85 return base::LaunchUnitTests( 113 return base::LaunchUnitTests(
86 argc, argv, base::Bind(&base::TestSuite::Run, 114 argc, argv, base::Bind(&base::TestSuite::Run,
87 base::Unretained(&test_suite))); 115 base::Unretained(&test_suite)));
88 } 116 }
OLDNEW
« no previous file with comments | « components/test/DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698