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

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

Issue 1550563002: Blink Platform: Remove time functions from Platform. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merrrge agaaain. Created 4 years, 10 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 15 matching lines...) Expand all
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 "platform/EventTracer.h" 31 #include "platform/EventTracer.h"
32 #include "platform/HTTPNames.h" 32 #include "platform/HTTPNames.h"
33 #include "platform/heap/Heap.h" 33 #include "platform/heap/Heap.h"
34 #include "platform/testing/TestingPlatformSupport.h" 34 #include "platform/testing/TestingPlatformSupport.h"
35 #include "wtf/CryptographicallyRandomNumber.h" 35 #include "wtf/CryptographicallyRandomNumber.h"
36 #include "wtf/CurrentTime.h"
36 #include "wtf/MainThread.h" 37 #include "wtf/MainThread.h"
37 #include "wtf/Partitions.h" 38 #include "wtf/Partitions.h"
38 #include "wtf/WTF.h" 39 #include "wtf/WTF.h"
39 #include <base/bind.h> 40 #include <base/bind.h>
40 #include <base/bind_helpers.h> 41 #include <base/bind_helpers.h>
41 #include <base/command_line.h> 42 #include <base/command_line.h>
42 #include <base/test/launcher/unit_test_launcher.h> 43 #include <base/test/launcher/unit_test_launcher.h>
43 #include <base/test/test_suite.h> 44 #include <base/test/test_suite.h>
44 #include <cc/blink/web_compositor_support_impl.h> 45 #include <cc/blink/web_compositor_support_impl.h>
45 #include <string.h> 46 #include <string.h>
46 47
47 static double CurrentTime() 48 static double dummyCurrentTime()
48 { 49 {
49 return 0.0; 50 return 0.0;
50 } 51 }
51 52
52 static int runTestSuite(base::TestSuite* testSuite) 53 static int runTestSuite(base::TestSuite* testSuite)
53 { 54 {
54 int result = testSuite->Run(); 55 int result = testSuite->Run();
55 blink::Heap::collectAllGarbage(); 56 blink::Heap::collectAllGarbage();
56 return result; 57 return result;
57 } 58 }
58 59
59 int main(int argc, char** argv) 60 int main(int argc, char** argv)
60 { 61 {
61 base::CommandLine::Init(argc, argv); 62 base::CommandLine::Init(argc, argv);
62 63
63 WTF::Partitions::initialize(nullptr); 64 WTF::Partitions::initialize(nullptr);
64 WTF::setAlwaysZeroRandomSourceForTesting(); 65 WTF::setTimeFunctionsForTesting(dummyCurrentTime);
65 WTF::initialize(CurrentTime, CurrentTime, nullptr); 66 WTF::initialize(nullptr);
66 WTF::initializeMainThread(0); 67 WTF::initializeMainThread(0);
67 68
68 blink::TestingPlatformSupport::Config platformConfig; 69 blink::TestingPlatformSupport::Config platformConfig;
69 cc_blink::WebCompositorSupportImpl compositorSupport; 70 cc_blink::WebCompositorSupportImpl compositorSupport;
70 platformConfig.compositorSupport = &compositorSupport; 71 platformConfig.compositorSupport = &compositorSupport;
71 blink::TestingPlatformSupport platform(platformConfig); 72 blink::TestingPlatformSupport platform(platformConfig);
72 73
73 blink::Heap::init(); 74 blink::Heap::init();
74 blink::ThreadState::attachMainThread(); 75 blink::ThreadState::attachMainThread();
75 blink::ThreadState::current()->registerTraceDOMWrappers(nullptr, nullptr); 76 blink::ThreadState::current()->registerTraceDOMWrappers(nullptr, nullptr);
76 blink::EventTracer::initialize(); 77 blink::EventTracer::initialize();
77 78
78 blink::HTTPNames::init(); 79 blink::HTTPNames::init();
79 80
80 base::TestSuite testSuite(argc, argv); 81 base::TestSuite testSuite(argc, argv);
81 int result = base::LaunchUnitTests(argc, argv, base::Bind(runTestSuite, base ::Unretained(&testSuite))); 82 int result = base::LaunchUnitTests(argc, argv, base::Bind(runTestSuite, base ::Unretained(&testSuite)));
82 83
83 blink::ThreadState::detachMainThread(); 84 blink::ThreadState::detachMainThread();
84 blink::Heap::shutdown(); 85 blink::Heap::shutdown();
85 86
86 WTF::shutdown(); 87 WTF::shutdown();
87 WTF::Partitions::shutdown(); 88 WTF::Partitions::shutdown();
88 return result; 89 return result;
89 } 90 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698