Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: third_party/WebKit/Source/platform/testing/RunAllTests.cpp

Issue 1780083002: Introduce Platform::setCurrentPlatformForTesting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 17 matching lines...) Expand all
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/heap/Heap.h" 36 #include "platform/heap/Heap.h"
37 #include "platform/testing/TestingPlatformSupport.h" 37 #include "platform/testing/TestingPlatformSupport.h"
38 #include "public/platform/Platform.h"
38 #include "wtf/CryptographicallyRandomNumber.h" 39 #include "wtf/CryptographicallyRandomNumber.h"
39 #include "wtf/CurrentTime.h" 40 #include "wtf/CurrentTime.h"
40 #include "wtf/MainThread.h" 41 #include "wtf/MainThread.h"
41 #include "wtf/Partitions.h" 42 #include "wtf/Partitions.h"
42 #include "wtf/WTF.h" 43 #include "wtf/WTF.h"
43 #include <base/bind.h> 44 #include <base/bind.h>
44 #include <base/bind_helpers.h> 45 #include <base/bind_helpers.h>
45 #include <base/command_line.h> 46 #include <base/command_line.h>
46 #include <base/test/launcher/unit_test_launcher.h> 47 #include <base/test/launcher/unit_test_launcher.h>
47 #include <base/test/test_suite.h> 48 #include <base/test/test_suite.h>
(...skipping 17 matching lines...) Expand all
65 66
66 int main(int argc, char** argv) 67 int main(int argc, char** argv)
67 { 68 {
68 base::CommandLine::Init(argc, argv); 69 base::CommandLine::Init(argc, argv);
69 70
70 WTF::Partitions::initialize(nullptr); 71 WTF::Partitions::initialize(nullptr);
71 WTF::setTimeFunctionsForTesting(dummyCurrentTime); 72 WTF::setTimeFunctionsForTesting(dummyCurrentTime);
72 WTF::initialize(nullptr); 73 WTF::initialize(nullptr);
73 WTF::initializeMainThread(0); 74 WTF::initializeMainThread(0);
74 75
76 blink::Platform::initialize(nullptr);
75 blink::TestingPlatformSupport::Config platformConfig; 77 blink::TestingPlatformSupport::Config platformConfig;
76 cc_blink::WebCompositorSupportImpl compositorSupport; 78 cc_blink::WebCompositorSupportImpl compositorSupport;
77 platformConfig.compositorSupport = &compositorSupport; 79 platformConfig.compositorSupport = &compositorSupport;
78 blink::TestingPlatformSupport platform(platformConfig); 80 blink::TestingPlatformSupport platform(platformConfig);
79 81
80 blink::Heap::init(); 82 blink::Heap::init();
81 blink::ThreadState::attachMainThread(); 83 blink::ThreadState::attachMainThread();
82 blink::ThreadState::current()->registerTraceDOMWrappers(nullptr, nullptr); 84 blink::ThreadState::current()->registerTraceDOMWrappers(nullptr, nullptr);
83 blink::EventTracer::initialize(); 85 blink::EventTracer::initialize();
84 86
85 blink::HTTPNames::init(); 87 blink::HTTPNames::init();
86 88
87 base::TestSuite testSuite(argc, argv); 89 base::TestSuite testSuite(argc, argv);
88 90
89 mojo::edk::Init(); 91 mojo::edk::Init();
90 base::TestIOThread testIoThread(base::TestIOThread::kAutoStart); 92 base::TestIOThread testIoThread(base::TestIOThread::kAutoStart);
91 WTF::OwnPtr<mojo::edk::test::ScopedIPCSupport> ipcSupport( 93 WTF::OwnPtr<mojo::edk::test::ScopedIPCSupport> ipcSupport(
92 adoptPtr(new mojo::edk::test::ScopedIPCSupport(testIoThread.task_runner( )))); 94 adoptPtr(new mojo::edk::test::ScopedIPCSupport(testIoThread.task_runner( ))));
93 95
94 int result = base::LaunchUnitTests(argc, argv, base::Bind(runTestSuite, base ::Unretained(&testSuite))); 96 int result = base::LaunchUnitTests(argc, argv, base::Bind(runTestSuite, base ::Unretained(&testSuite)));
95 97
96 blink::ThreadState::detachMainThread(); 98 blink::ThreadState::detachMainThread();
97 blink::Heap::shutdown(); 99 blink::Heap::shutdown();
98 100
101 blink::Platform::shutdown();
102
99 WTF::shutdown(); 103 WTF::shutdown();
100 WTF::Partitions::shutdown(); 104 WTF::Partitions::shutdown();
101 return result; 105 return result;
102 } 106 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698