OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 15 matching lines...) Expand all Loading... |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "base/test/test_io_thread.h" | 31 #include "base/test/test_io_thread.h" |
32 #include "mojo/edk/embedder/embedder.h" | 32 #include "mojo/edk/embedder/embedder.h" |
33 #include "mojo/edk/test/scoped_ipc_support.h" | 33 #include "mojo/edk/test/scoped_ipc_support.h" |
34 #include "platform/EventTracer.h" | 34 #include "platform/EventTracer.h" |
35 #include "platform/HTTPNames.h" | 35 #include "platform/HTTPNames.h" |
| 36 #include "platform/graphics/CompositorFactory.h" |
36 #include "platform/heap/Heap.h" | 37 #include "platform/heap/Heap.h" |
37 #include "platform/testing/TestingPlatformSupport.h" | 38 #include "platform/testing/TestingPlatformSupport.h" |
38 #include "public/platform/Platform.h" | 39 #include "public/platform/Platform.h" |
39 #include "wtf/CryptographicallyRandomNumber.h" | 40 #include "wtf/CryptographicallyRandomNumber.h" |
40 #include "wtf/CurrentTime.h" | 41 #include "wtf/CurrentTime.h" |
41 #include "wtf/MainThread.h" | 42 #include "wtf/MainThread.h" |
42 #include "wtf/Partitions.h" | 43 #include "wtf/Partitions.h" |
43 #include "wtf/WTF.h" | 44 #include "wtf/WTF.h" |
44 #include <base/bind.h> | 45 #include <base/bind.h> |
45 #include <base/bind_helpers.h> | 46 #include <base/bind_helpers.h> |
(...skipping 20 matching lines...) Expand all Loading... |
66 public: | 67 public: |
67 DummyPlatform() { } | 68 DummyPlatform() { } |
68 }; | 69 }; |
69 | 70 |
70 } // namespace | 71 } // namespace |
71 | 72 |
72 int main(int argc, char** argv) | 73 int main(int argc, char** argv) |
73 { | 74 { |
74 base::CommandLine::Init(argc, argv); | 75 base::CommandLine::Init(argc, argv); |
75 | 76 |
| 77 OwnPtr<DummyPlatform> platform = adoptPtr(new DummyPlatform); |
| 78 blink::Platform::setCurrentPlatformForTesting(platform.get()); |
| 79 |
76 WTF::Partitions::initialize(nullptr); | 80 WTF::Partitions::initialize(nullptr); |
77 WTF::setTimeFunctionsForTesting(dummyCurrentTime); | 81 WTF::setTimeFunctionsForTesting(dummyCurrentTime); |
78 WTF::initialize(); | 82 WTF::initialize(); |
79 WTF::initializeMainThread(0); | 83 WTF::initializeMainThread(0); |
| 84 blink::CompositorFactory::initializeDefault(); |
80 int result = 0; | 85 int result = 0; |
81 { | 86 { |
82 OwnPtr<DummyPlatform> platform = adoptPtr(new DummyPlatform); | 87 blink::TestingPlatformSupport::Config platformConfig; |
83 blink::Platform::initialize(platform.get()); | 88 cc_blink::WebCompositorSupportImpl compositorSupport; |
84 { | 89 platformConfig.compositorSupport = &compositorSupport; |
85 blink::TestingPlatformSupport::Config platformConfig; | 90 blink::TestingPlatformSupport platform(platformConfig); |
86 cc_blink::WebCompositorSupportImpl compositorSupport; | |
87 platformConfig.compositorSupport = &compositorSupport; | |
88 blink::TestingPlatformSupport platform(platformConfig); | |
89 | 91 |
90 blink::Heap::init(); | 92 blink::Heap::init(); |
91 blink::ThreadState::attachMainThread(); | 93 blink::ThreadState::attachMainThread(); |
92 blink::ThreadState::current()->registerTraceDOMWrappers(nullptr, nul
lptr); | 94 blink::ThreadState::current()->registerTraceDOMWrappers(nullptr, nullptr
); |
93 blink::EventTracer::initialize(); | 95 blink::EventTracer::initialize(); |
| 96 blink::HTTPNames::init(); |
94 | 97 |
95 blink::HTTPNames::init(); | 98 base::TestSuite testSuite(argc, argv); |
96 | 99 |
97 base::TestSuite testSuite(argc, argv); | 100 mojo::edk::Init(); |
| 101 base::TestIOThread testIoThread(base::TestIOThread::kAutoStart); |
| 102 WTF::OwnPtr<mojo::edk::test::ScopedIPCSupport> ipcSupport(adoptPtr(new m
ojo::edk::test::ScopedIPCSupport(testIoThread.task_runner()))); |
| 103 result = base::LaunchUnitTests(argc, argv, base::Bind(runTestSuite, base
::Unretained(&testSuite))); |
98 | 104 |
99 mojo::edk::Init(); | 105 blink::ThreadState::detachMainThread(); |
100 base::TestIOThread testIoThread(base::TestIOThread::kAutoStart); | 106 blink::Heap::shutdown(); |
101 WTF::OwnPtr<mojo::edk::test::ScopedIPCSupport> ipcSupport(adoptPtr(n
ew mojo::edk::test::ScopedIPCSupport(testIoThread.task_runner()))); | |
102 result = base::LaunchUnitTests(argc, argv, base::Bind(runTestSuite,
base::Unretained(&testSuite))); | |
103 | |
104 blink::ThreadState::detachMainThread(); | |
105 blink::Heap::shutdown(); | |
106 } | |
107 blink::Platform::shutdown(); | |
108 } | 107 } |
109 | 108 blink::CompositorFactory::shutdown(); |
110 WTF::shutdown(); | 109 WTF::shutdown(); |
111 WTF::Partitions::shutdown(); | 110 WTF::Partitions::shutdown(); |
112 return result; | 111 return result; |
113 } | 112 } |
OLD | NEW |