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

Side by Side Diff: content/test/content_test_launcher.cc

Issue 12088031: Revert 179189 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « content/shell/android/shell_library_loader.cc ('k') | content/test/run_all_unittests.cc » ('j') | 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 "content/public/test/test_launcher.h" 5 #include "content/public/test/test_launcher.h"
6 6
7 #include "base/base_paths.h" 7 #include "base/base_paths.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/test/test_suite.h" 11 #include "base/test/test_suite.h"
12 #include "content/public/common/content_switches.h" 12 #include "content/public/common/content_switches.h"
13 #include "content/public/test/content_test_suite_base.h" 13 #include "content/public/test/content_test_suite_base.h"
14 #include "content/shell/shell_content_browser_client.h" 14 #include "content/shell/shell_content_browser_client.h"
15 #include "content/shell/shell_content_client.h" 15 #include "content/shell/shell_content_client.h"
16 #include "content/shell/shell_main_delegate.h" 16 #include "content/shell/shell_main_delegate.h"
17 #include "content/shell/shell_switches.h" 17 #include "content/shell/shell_switches.h"
18 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
19 19
20 #if defined(OS_ANDROID)
21 #include "base/message_loop.h"
22 #include "base/message_pump_android.h"
23 #endif
24
25 #if defined(OS_WIN) 20 #if defined(OS_WIN)
26 #include "content/public/app/startup_helper_win.h" 21 #include "content/public/app/startup_helper_win.h"
27 #include "sandbox/win/src/sandbox_types.h" 22 #include "sandbox/win/src/sandbox_types.h"
28 #endif // defined(OS_WIN) 23 #endif // defined(OS_WIN)
29 24
30 namespace content { 25 namespace content {
31 26
32 class ContentShellTestSuiteInitializer 27 class ContentShellTestSuiteInitializer
33 : public testing::EmptyTestEventListener { 28 : public testing::EmptyTestEventListener {
34 public: 29 public:
(...skipping 15 matching lines...) Expand all
50 SetContentClient(NULL); 45 SetContentClient(NULL);
51 } 46 }
52 47
53 private: 48 private:
54 scoped_ptr<ShellContentClient> content_client_; 49 scoped_ptr<ShellContentClient> content_client_;
55 scoped_ptr<ShellContentBrowserClient> browser_content_client_; 50 scoped_ptr<ShellContentBrowserClient> browser_content_client_;
56 51
57 DISALLOW_COPY_AND_ASSIGN(ContentShellTestSuiteInitializer); 52 DISALLOW_COPY_AND_ASSIGN(ContentShellTestSuiteInitializer);
58 }; 53 };
59 54
60 #if defined(OS_ANDROID)
61 base::MessagePump* CreateMessagePumpForUI() {
62 return new base::MessagePumpForUI();
63 };
64 #endif
65
66 class ContentBrowserTestSuite : public ContentTestSuiteBase { 55 class ContentBrowserTestSuite : public ContentTestSuiteBase {
67 public: 56 public:
68 ContentBrowserTestSuite(int argc, char** argv) 57 ContentBrowserTestSuite(int argc, char** argv)
69 : ContentTestSuiteBase(argc, argv) { 58 : ContentTestSuiteBase(argc, argv) {
70 } 59 }
71 virtual ~ContentBrowserTestSuite() { 60 virtual ~ContentBrowserTestSuite() {
72 } 61 }
73 62
74 protected: 63 protected:
75 virtual void Initialize() OVERRIDE { 64 virtual void Initialize() OVERRIDE {
76
77 #if defined(OS_ANDROID)
78 // This needs to be done before base::TestSuite::Initialize() is called,
79 // as it also tries to set MessagePumpForUIFactory.
80 if (!MessageLoop::InitMessagePumpForUIFactory(&CreateMessagePumpForUI))
81 LOG(INFO) << "MessagePumpForUIFactory already set, unable to override.";
82 #endif
83
84 ContentTestSuiteBase::Initialize(); 65 ContentTestSuiteBase::Initialize();
85 66
86 testing::TestEventListeners& listeners = 67 testing::TestEventListeners& listeners =
87 testing::UnitTest::GetInstance()->listeners(); 68 testing::UnitTest::GetInstance()->listeners();
88 listeners.Append(new ContentShellTestSuiteInitializer); 69 listeners.Append(new ContentShellTestSuiteInitializer);
89 } 70 }
90 virtual void Shutdown() OVERRIDE { 71 virtual void Shutdown() OVERRIDE {
91 base::TestSuite::Shutdown(); 72 base::TestSuite::Shutdown();
92 } 73 }
93 74
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 private: 108 private:
128 DISALLOW_COPY_AND_ASSIGN(ContentTestLauncherDelegate); 109 DISALLOW_COPY_AND_ASSIGN(ContentTestLauncherDelegate);
129 }; 110 };
130 111
131 } // namespace content 112 } // namespace content
132 113
133 int main(int argc, char** argv) { 114 int main(int argc, char** argv) {
134 content::ContentTestLauncherDelegate launcher_delegate; 115 content::ContentTestLauncherDelegate launcher_delegate;
135 return LaunchTests(&launcher_delegate, argc, argv); 116 return LaunchTests(&launcher_delegate, argc, argv);
136 } 117 }
OLDNEW
« no previous file with comments | « content/shell/android/shell_library_loader.cc ('k') | content/test/run_all_unittests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698