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