| OLD | NEW |
| 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" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 return new ShellContentClient(); | 78 return new ShellContentClient(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 #if defined(OS_WIN) | 81 #if defined(OS_WIN) |
| 82 ui::ScopedOleInitializer ole_initializer_; | 82 ui::ScopedOleInitializer ole_initializer_; |
| 83 #endif | 83 #endif |
| 84 | 84 |
| 85 DISALLOW_COPY_AND_ASSIGN(ContentBrowserTestSuite); | 85 DISALLOW_COPY_AND_ASSIGN(ContentBrowserTestSuite); |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 } // namespace content | |
| 89 | |
| 90 class ContentTestLauncherDelegate : public test_launcher::TestLauncherDelegate { | 88 class ContentTestLauncherDelegate : public test_launcher::TestLauncherDelegate { |
| 91 public: | 89 public: |
| 92 ContentTestLauncherDelegate() { | 90 ContentTestLauncherDelegate() { |
| 93 } | 91 } |
| 94 | 92 |
| 95 virtual ~ContentTestLauncherDelegate() { | 93 virtual ~ContentTestLauncherDelegate() { |
| 96 } | 94 } |
| 97 | 95 |
| 98 virtual void EarlyInitialize() OVERRIDE { | 96 virtual void EarlyInitialize() OVERRIDE { |
| 99 } | 97 } |
| 100 | 98 |
| 101 virtual bool Run(int argc, char** argv, int* return_code) OVERRIDE { | 99 virtual bool Run(int argc, char** argv, int* return_code) OVERRIDE { |
| 102 #if defined(OS_WIN) || defined(OS_LINUX) | 100 #if defined(OS_WIN) || defined(OS_LINUX) |
| 103 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 101 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 104 if (command_line->HasSwitch(switches::kProcessType)) { | 102 if (command_line->HasSwitch(switches::kProcessType)) { |
| 105 ShellMainDelegate delegate; | 103 ShellMainDelegate delegate; |
| 106 #if defined(OS_WIN) | 104 #if defined(OS_WIN) |
| 107 sandbox::SandboxInterfaceInfo sandbox_info = {0}; | 105 sandbox::SandboxInterfaceInfo sandbox_info = {0}; |
| 108 content::InitializeSandboxInfo(&sandbox_info); | 106 InitializeSandboxInfo(&sandbox_info); |
| 109 *return_code = | 107 *return_code = |
| 110 content::ContentMain(GetModuleHandle(NULL), &sandbox_info, &delegate); | 108 ContentMain(GetModuleHandle(NULL), &sandbox_info, &delegate); |
| 111 #elif defined(OS_LINUX) | 109 #elif defined(OS_LINUX) |
| 112 *return_code = content::ContentMain(argc, | 110 *return_code = ContentMain(argc, |
| 113 const_cast<const char**>(argv), | 111 const_cast<const char**>(argv), |
| 114 &delegate); | 112 &delegate); |
| 115 #endif // defined(OS_WIN) | 113 #endif // defined(OS_WIN) |
| 116 return true; | 114 return true; |
| 117 } | 115 } |
| 118 #endif // defined(OS_WIN) || defined(OS_LINUX) | 116 #endif // defined(OS_WIN) || defined(OS_LINUX) |
| 119 | 117 |
| 120 return false; | 118 return false; |
| 121 } | 119 } |
| 122 | 120 |
| 123 virtual int RunTestSuite(int argc, char** argv) OVERRIDE { | 121 virtual int RunTestSuite(int argc, char** argv) OVERRIDE { |
| 124 return content::ContentBrowserTestSuite(argc, argv).Run(); | 122 return ContentBrowserTestSuite(argc, argv).Run(); |
| 125 } | 123 } |
| 126 | 124 |
| 127 virtual bool AdjustChildProcessCommandLine( | 125 virtual bool AdjustChildProcessCommandLine( |
| 128 CommandLine* command_line) OVERRIDE { | 126 CommandLine* command_line) OVERRIDE { |
| 129 return true; | 127 return true; |
| 130 } | 128 } |
| 131 | 129 |
| 132 private: | 130 private: |
| 133 DISALLOW_COPY_AND_ASSIGN(ContentTestLauncherDelegate); | 131 DISALLOW_COPY_AND_ASSIGN(ContentTestLauncherDelegate); |
| 134 }; | 132 }; |
| 135 | 133 |
| 134 } // namespace content |
| 135 |
| 136 int main(int argc, char** argv) { | 136 int main(int argc, char** argv) { |
| 137 ContentTestLauncherDelegate launcher_delegate; | 137 content::ContentTestLauncherDelegate launcher_delegate; |
| 138 return test_launcher::LaunchTests(&launcher_delegate, argc, argv); | 138 return test_launcher::LaunchTests(&launcher_delegate, argc, argv); |
| 139 } | 139 } |
| OLD | NEW |