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 22 matching lines...) Expand all Loading... |
33 #include "base/test/test_io_thread.h" | 33 #include "base/test/test_io_thread.h" |
34 #include "mojo/edk/embedder/embedder.h" | 34 #include "mojo/edk/embedder/embedder.h" |
35 #include "mojo/edk/test/scoped_ipc_support.h" | 35 #include "mojo/edk/test/scoped_ipc_support.h" |
36 #include "platform/EventTracer.h" | 36 #include "platform/EventTracer.h" |
37 #include "platform/HTTPNames.h" | 37 #include "platform/HTTPNames.h" |
38 #include "platform/heap/Heap.h" | 38 #include "platform/heap/Heap.h" |
39 #include "platform/testing/TestingPlatformSupport.h" | 39 #include "platform/testing/TestingPlatformSupport.h" |
40 #include "public/platform/Platform.h" | 40 #include "public/platform/Platform.h" |
41 #include "wtf/CryptographicallyRandomNumber.h" | 41 #include "wtf/CryptographicallyRandomNumber.h" |
42 #include "wtf/CurrentTime.h" | 42 #include "wtf/CurrentTime.h" |
43 #include "wtf/PtrUtil.h" | |
44 #include "wtf/WTF.h" | 43 #include "wtf/WTF.h" |
45 #include "wtf/allocator/Partitions.h" | 44 #include "wtf/allocator/Partitions.h" |
46 #include <base/bind.h> | 45 #include <base/bind.h> |
47 #include <base/bind_helpers.h> | 46 #include <base/bind_helpers.h> |
48 #include <base/command_line.h> | 47 #include <base/command_line.h> |
49 #include <base/metrics/statistics_recorder.h> | 48 #include <base/metrics/statistics_recorder.h> |
50 #include <base/test/launcher/unit_test_launcher.h> | 49 #include <base/test/launcher/unit_test_launcher.h> |
51 #include <base/test/test_suite.h> | 50 #include <base/test/test_suite.h> |
52 #include <cc/blink/web_compositor_support_impl.h> | 51 #include <cc/blink/web_compositor_support_impl.h> |
53 #include <memory> | |
54 | 52 |
55 namespace { | 53 namespace { |
56 | 54 |
57 double dummyCurrentTime() | 55 double dummyCurrentTime() |
58 { | 56 { |
59 return 0.0; | 57 return 0.0; |
60 } | 58 } |
61 | 59 |
62 int runTestSuite(base::TestSuite* testSuite) | 60 int runTestSuite(base::TestSuite* testSuite) |
63 { | 61 { |
(...skipping 11 matching lines...) Expand all Loading... |
75 | 73 |
76 int main(int argc, char** argv) | 74 int main(int argc, char** argv) |
77 { | 75 { |
78 base::CommandLine::Init(argc, argv); | 76 base::CommandLine::Init(argc, argv); |
79 | 77 |
80 base::TestDiscardableMemoryAllocator discardableMemoryAllocator; | 78 base::TestDiscardableMemoryAllocator discardableMemoryAllocator; |
81 base::DiscardableMemoryAllocator::SetInstance(&discardableMemoryAllocator); | 79 base::DiscardableMemoryAllocator::SetInstance(&discardableMemoryAllocator); |
82 | 80 |
83 base::StatisticsRecorder::Initialize(); | 81 base::StatisticsRecorder::Initialize(); |
84 | 82 |
85 std::unique_ptr<DummyPlatform> platform = wrapUnique(new DummyPlatform); | 83 OwnPtr<DummyPlatform> platform = adoptPtr(new DummyPlatform); |
86 blink::Platform::setCurrentPlatformForTesting(platform.get()); | 84 blink::Platform::setCurrentPlatformForTesting(platform.get()); |
87 | 85 |
88 WTF::Partitions::initialize(nullptr); | 86 WTF::Partitions::initialize(nullptr); |
89 WTF::setTimeFunctionsForTesting(dummyCurrentTime); | 87 WTF::setTimeFunctionsForTesting(dummyCurrentTime); |
90 WTF::initialize(nullptr); | 88 WTF::initialize(nullptr); |
91 int result = 0; | 89 int result = 0; |
92 { | 90 { |
93 blink::TestingPlatformSupport::Config platformConfig; | 91 blink::TestingPlatformSupport::Config platformConfig; |
94 cc_blink::WebCompositorSupportImpl compositorSupport; | 92 cc_blink::WebCompositorSupportImpl compositorSupport; |
95 platformConfig.compositorSupport = &compositorSupport; | 93 platformConfig.compositorSupport = &compositorSupport; |
96 blink::TestingPlatformSupport platform(platformConfig); | 94 blink::TestingPlatformSupport platform(platformConfig); |
97 | 95 |
98 blink::ProcessHeap::init(); | 96 blink::ProcessHeap::init(); |
99 blink::ThreadState::attachMainThread(); | 97 blink::ThreadState::attachMainThread(); |
100 blink::ThreadState::current()->registerTraceDOMWrappers(nullptr, nullptr
, nullptr); | 98 blink::ThreadState::current()->registerTraceDOMWrappers(nullptr, nullptr
, nullptr); |
101 blink::EventTracer::initialize(); | 99 blink::EventTracer::initialize(); |
102 blink::HTTPNames::init(); | 100 blink::HTTPNames::init(); |
103 | 101 |
104 base::TestSuite testSuite(argc, argv); | 102 base::TestSuite testSuite(argc, argv); |
105 | 103 |
106 mojo::edk::Init(); | 104 mojo::edk::Init(); |
107 base::TestIOThread testIoThread(base::TestIOThread::kAutoStart); | 105 base::TestIOThread testIoThread(base::TestIOThread::kAutoStart); |
108 std::unique_ptr<mojo::edk::test::ScopedIPCSupport> ipcSupport(wrapUnique
(new mojo::edk::test::ScopedIPCSupport(testIoThread.task_runner()))); | 106 WTF::OwnPtr<mojo::edk::test::ScopedIPCSupport> ipcSupport(adoptPtr(new m
ojo::edk::test::ScopedIPCSupport(testIoThread.task_runner()))); |
109 result = base::LaunchUnitTests(argc, argv, base::Bind(runTestSuite, base
::Unretained(&testSuite))); | 107 result = base::LaunchUnitTests(argc, argv, base::Bind(runTestSuite, base
::Unretained(&testSuite))); |
110 | 108 |
111 blink::ThreadState::detachMainThread(); | 109 blink::ThreadState::detachMainThread(); |
112 blink::ProcessHeap::shutdown(); | 110 blink::ProcessHeap::shutdown(); |
113 } | 111 } |
114 WTF::shutdown(); | 112 WTF::shutdown(); |
115 WTF::Partitions::shutdown(); | 113 WTF::Partitions::shutdown(); |
116 return result; | 114 return result; |
117 } | 115 } |
OLD | NEW |