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

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

Issue 1740843002: Revert of Migrates battery_status from content/renderer/ to WebKit/platform/ (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 10 matching lines...) Expand all
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
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 "base/test/test_io_thread.h"
32 #include "mojo/edk/embedder/embedder.h"
33 #include "mojo/edk/test/scoped_ipc_support.h"
34 #include "platform/EventTracer.h" 31 #include "platform/EventTracer.h"
35 #include "platform/HTTPNames.h" 32 #include "platform/HTTPNames.h"
36 #include "platform/heap/Heap.h" 33 #include "platform/heap/Heap.h"
37 #include "platform/testing/TestingPlatformSupport.h" 34 #include "platform/testing/TestingPlatformSupport.h"
38 #include "wtf/CryptographicallyRandomNumber.h" 35 #include "wtf/CryptographicallyRandomNumber.h"
39 #include "wtf/CurrentTime.h" 36 #include "wtf/CurrentTime.h"
40 #include "wtf/MainThread.h" 37 #include "wtf/MainThread.h"
41 #include "wtf/Partitions.h" 38 #include "wtf/Partitions.h"
42 #include "wtf/WTF.h" 39 #include "wtf/WTF.h"
43 #include <base/bind.h> 40 #include <base/bind.h>
44 #include <base/bind_helpers.h> 41 #include <base/bind_helpers.h>
45 #include <base/command_line.h> 42 #include <base/command_line.h>
46 #include <base/test/launcher/unit_test_launcher.h> 43 #include <base/test/launcher/unit_test_launcher.h>
47 #include <base/test/test_suite.h> 44 #include <base/test/test_suite.h>
48 #include <cc/blink/web_compositor_support_impl.h> 45 #include <cc/blink/web_compositor_support_impl.h>
46 #include <string.h>
49 47
50 namespace { 48 static double dummyCurrentTime()
51
52 double dummyCurrentTime()
53 { 49 {
54 return 0.0; 50 return 0.0;
55 } 51 }
56 52
57 int runTestSuite(base::TestSuite* testSuite) 53 static int runTestSuite(base::TestSuite* testSuite)
58 { 54 {
59 int result = testSuite->Run(); 55 int result = testSuite->Run();
60 blink::Heap::collectAllGarbage(); 56 blink::Heap::collectAllGarbage();
61 return result; 57 return result;
62 } 58 }
63 59
64 } // namespace
65
66 int main(int argc, char** argv) 60 int main(int argc, char** argv)
67 { 61 {
68 base::CommandLine::Init(argc, argv); 62 base::CommandLine::Init(argc, argv);
69 63
70 WTF::Partitions::initialize(nullptr); 64 WTF::Partitions::initialize(nullptr);
71 WTF::setTimeFunctionsForTesting(dummyCurrentTime); 65 WTF::setTimeFunctionsForTesting(dummyCurrentTime);
72 WTF::initialize(nullptr); 66 WTF::initialize(nullptr);
73 WTF::initializeMainThread(0); 67 WTF::initializeMainThread(0);
74 68
75 blink::TestingPlatformSupport::Config platformConfig; 69 blink::TestingPlatformSupport::Config platformConfig;
76 cc_blink::WebCompositorSupportImpl compositorSupport; 70 cc_blink::WebCompositorSupportImpl compositorSupport;
77 platformConfig.compositorSupport = &compositorSupport; 71 platformConfig.compositorSupport = &compositorSupport;
78 blink::TestingPlatformSupport platform(platformConfig); 72 blink::TestingPlatformSupport platform(platformConfig);
79 73
80 blink::Heap::init(); 74 blink::Heap::init();
81 blink::ThreadState::attachMainThread(); 75 blink::ThreadState::attachMainThread();
82 blink::ThreadState::current()->registerTraceDOMWrappers(nullptr, nullptr); 76 blink::ThreadState::current()->registerTraceDOMWrappers(nullptr, nullptr);
83 blink::EventTracer::initialize(); 77 blink::EventTracer::initialize();
84 78
85 blink::HTTPNames::init(); 79 blink::HTTPNames::init();
86 80
87 base::TestSuite testSuite(argc, argv); 81 base::TestSuite testSuite(argc, argv);
88
89 mojo::edk::Init();
90 base::TestIOThread testIoThread(base::TestIOThread::kAutoStart);
91 WTF::OwnPtr<mojo::edk::test::ScopedIPCSupport> ipcSupport(
92 adoptPtr(new mojo::edk::test::ScopedIPCSupport(testIoThread.task_runner( ))));
93
94 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)));
95 83
96 blink::ThreadState::detachMainThread(); 84 blink::ThreadState::detachMainThread();
97 blink::Heap::shutdown(); 85 blink::Heap::shutdown();
98 86
99 WTF::shutdown(); 87 WTF::shutdown();
100 WTF::Partitions::shutdown(); 88 WTF::Partitions::shutdown();
101 return result; 89 return result;
102 } 90 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698