| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // Run all of our test shell tests. This is just an entry point | 5 // Run all of our test shell tests. This is just an entry point |
| 6 // to kick off gTest's RUN_ALL_TESTS(). | 6 // to kick off gTest's RUN_ALL_TESTS(). |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 | 9 |
| 10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 "window.addEventListener('load', function() {" | 37 "window.addEventListener('load', function() {" |
| 38 " var x = document.body.clientWidth;" // Force a document layout | 38 " var x = document.body.clientWidth;" // Force a document layout |
| 39 " window.layoutTestController.notifyDone();" | 39 " window.layoutTestController.notifyDone();" |
| 40 "});" | 40 "});" |
| 41 "</script>"; | 41 "</script>"; |
| 42 | 42 |
| 43 class TestShellTestSuite : public base::TestSuite { | 43 class TestShellTestSuite : public base::TestSuite { |
| 44 public: | 44 public: |
| 45 TestShellTestSuite(int argc, char** argv) | 45 TestShellTestSuite(int argc, char** argv) |
| 46 : base::TestSuite(argc, argv), | 46 : base::TestSuite(argc, argv), |
| 47 test_shell_webkit_init_(true), | 47 platform_delegate_(*CommandLine::ForCurrentProcess()), |
| 48 platform_delegate_(*CommandLine::ForCurrentProcess()) { | 48 test_shell_webkit_init_(true) { |
| 49 } | 49 } |
| 50 | 50 |
| 51 virtual void Initialize() { | 51 virtual void Initialize() { |
| 52 // Override DIR_EXE early in case anything in base::TestSuite uses it. | 52 // Override DIR_EXE early in case anything in base::TestSuite uses it. |
| 53 #if defined(OS_MACOSX) | 53 #if defined(OS_MACOSX) |
| 54 FilePath path; | 54 FilePath path; |
| 55 PathService::Get(base::DIR_EXE, &path); | 55 PathService::Get(base::DIR_EXE, &path); |
| 56 path = path.AppendASCII("TestShell.app"); | 56 path = path.AppendASCII("TestShell.app"); |
| 57 base::mac::SetOverrideAppBundlePath(path); | 57 base::mac::SetOverrideAppBundlePath(path); |
| 58 #endif | 58 #endif |
| (...skipping 27 matching lines...) Expand all Loading... |
| 86 } | 86 } |
| 87 | 87 |
| 88 virtual void Shutdown() { | 88 virtual void Shutdown() { |
| 89 TestShell::ShutdownTestShell(); | 89 TestShell::ShutdownTestShell(); |
| 90 TestShell::CleanupLogging(); | 90 TestShell::CleanupLogging(); |
| 91 | 91 |
| 92 base::TestSuite::Shutdown(); | 92 base::TestSuite::Shutdown(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 private: | 95 private: |
| 96 TestShellPlatformDelegate platform_delegate_; |
| 97 |
| 96 // Allocate a message loop for this thread. Although it is not used | 98 // Allocate a message loop for this thread. Although it is not used |
| 97 // directly, its constructor sets up some necessary state. | 99 // directly, its constructor sets up some necessary state. |
| 98 MessageLoopForUI main_message_loop_; | 100 MessageLoopForUI main_message_loop_; |
| 99 | 101 |
| 100 // Initialize WebKit for this scope. | 102 // Initialize WebKit for this scope. |
| 101 TestShellWebKitInit test_shell_webkit_init_; | 103 TestShellWebKitInit test_shell_webkit_init_; |
| 102 | 104 |
| 103 TestShellPlatformDelegate platform_delegate_; | |
| 104 | |
| 105 DISALLOW_COPY_AND_ASSIGN(TestShellTestSuite); | 105 DISALLOW_COPY_AND_ASSIGN(TestShellTestSuite); |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 int main(int argc, char** argv) { | 108 int main(int argc, char** argv) { |
| 109 #if defined(OS_MACOSX) | 109 #if defined(OS_MACOSX) |
| 110 base::mac::ScopedNSAutoreleasePool scoped_pool; | 110 base::mac::ScopedNSAutoreleasePool scoped_pool; |
| 111 #endif | 111 #endif |
| 112 | 112 |
| 113 TestShellPlatformDelegate::PreflightArgs(&argc, &argv); | 113 TestShellPlatformDelegate::PreflightArgs(&argc, &argv); |
| 114 return TestShellTestSuite(argc, argv).Run(); | 114 return TestShellTestSuite(argc, argv).Run(); |
| 115 } | 115 } |
| OLD | NEW |