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

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

Issue 1785483003: Make sure that s_platform is non-null (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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 return 0.0; 55 return 0.0;
56 } 56 }
57 57
58 int runTestSuite(base::TestSuite* testSuite) 58 int runTestSuite(base::TestSuite* testSuite)
59 { 59 {
60 int result = testSuite->Run(); 60 int result = testSuite->Run();
61 blink::Heap::collectAllGarbage(); 61 blink::Heap::collectAllGarbage();
62 return result; 62 return result;
63 } 63 }
64 64
65 class DummyPlatform final : public blink::Platform {
66 public:
67 DummyPlatform() { }
68 };
69
65 } // namespace 70 } // namespace
66 71
67 int main(int argc, char** argv) 72 int main(int argc, char** argv)
68 { 73 {
69 base::CommandLine::Init(argc, argv); 74 base::CommandLine::Init(argc, argv);
70 75
71 WTF::Partitions::initialize(nullptr); 76 WTF::Partitions::initialize(nullptr);
72 WTF::setTimeFunctionsForTesting(dummyCurrentTime); 77 WTF::setTimeFunctionsForTesting(dummyCurrentTime);
73 WTF::initialize(nullptr); 78 WTF::initialize(nullptr);
74 WTF::initializeMainThread(0); 79 WTF::initializeMainThread(0);
80 int result = 0;
81 {
82 OwnPtr<DummyPlatform> platform = adoptPtr(new DummyPlatform);
83 blink::Platform::initialize(platform.get());
84 {
85 blink::TestingPlatformSupport::Config platformConfig;
86 cc_blink::WebCompositorSupportImpl compositorSupport;
87 platformConfig.compositorSupport = &compositorSupport;
88 blink::TestingPlatformSupport platform(platformConfig);
75 89
76 blink::Platform::initialize(nullptr); 90 blink::Heap::init();
77 blink::TestingPlatformSupport::Config platformConfig; 91 blink::ThreadState::attachMainThread();
78 cc_blink::WebCompositorSupportImpl compositorSupport; 92 blink::ThreadState::current()->registerTraceDOMWrappers(nullptr, nul lptr);
79 platformConfig.compositorSupport = &compositorSupport; 93 blink::EventTracer::initialize();
80 blink::TestingPlatformSupport platform(platformConfig);
81 94
82 blink::Heap::init(); 95 blink::HTTPNames::init();
83 blink::ThreadState::attachMainThread();
84 blink::ThreadState::current()->registerTraceDOMWrappers(nullptr, nullptr);
85 blink::EventTracer::initialize();
86 96
87 blink::HTTPNames::init(); 97 base::TestSuite testSuite(argc, argv);
88 98
89 base::TestSuite testSuite(argc, argv); 99 mojo::edk::Init();
100 base::TestIOThread testIoThread(base::TestIOThread::kAutoStart);
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)));
90 103
91 mojo::edk::Init(); 104 blink::ThreadState::detachMainThread();
92 base::TestIOThread testIoThread(base::TestIOThread::kAutoStart); 105 blink::Heap::shutdown();
93 WTF::OwnPtr<mojo::edk::test::ScopedIPCSupport> ipcSupport( 106 }
94 adoptPtr(new mojo::edk::test::ScopedIPCSupport(testIoThread.task_runner( )))); 107 blink::Platform::shutdown();
95 108 }
96 int result = base::LaunchUnitTests(argc, argv, base::Bind(runTestSuite, base ::Unretained(&testSuite)));
97
98 blink::ThreadState::detachMainThread();
99 blink::Heap::shutdown();
100
101 blink::Platform::shutdown();
102 109
103 WTF::shutdown(); 110 WTF::shutdown();
104 WTF::Partitions::shutdown(); 111 WTF::Partitions::shutdown();
105 return result; 112 return result;
106 } 113 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698