| 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 20 matching lines...) Expand all Loading... |
| 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/MainThread.h" | 36 #include "wtf/MainThread.h" |
| 37 #include "wtf/Partitions.h" | 37 #include "wtf/Partitions.h" |
| 38 #include "wtf/WTF.h" | 38 #include "wtf/WTF.h" |
| 39 #include <base/bind.h> | 39 #include <base/bind.h> |
| 40 #include <base/bind_helpers.h> | 40 #include <base/bind_helpers.h> |
| 41 #include <base/command_line.h> |
| 41 #include <base/test/launcher/unit_test_launcher.h> | 42 #include <base/test/launcher/unit_test_launcher.h> |
| 42 #include <base/test/test_suite.h> | 43 #include <base/test/test_suite.h> |
| 43 #include <cc/blink/web_compositor_support_impl.h> | 44 #include <cc/blink/web_compositor_support_impl.h> |
| 44 #include <string.h> | 45 #include <string.h> |
| 45 | 46 |
| 46 static double CurrentTime() | 47 static double CurrentTime() |
| 47 { | 48 { |
| 48 return 0.0; | 49 return 0.0; |
| 49 } | 50 } |
| 50 | 51 |
| 51 static int runTestSuite(base::TestSuite* testSuite) | 52 static int runTestSuite(base::TestSuite* testSuite) |
| 52 { | 53 { |
| 53 int result = testSuite->Run(); | 54 int result = testSuite->Run(); |
| 54 blink::Heap::collectAllGarbage(); | 55 blink::Heap::collectAllGarbage(); |
| 55 return result; | 56 return result; |
| 56 } | 57 } |
| 57 | 58 |
| 58 int main(int argc, char** argv) | 59 int main(int argc, char** argv) |
| 59 { | 60 { |
| 61 base::CommandLine::Init(argc, argv); |
| 62 |
| 60 WTF::Partitions::initialize(nullptr); | 63 WTF::Partitions::initialize(nullptr); |
| 61 WTF::setAlwaysZeroRandomSourceForTesting(); | 64 WTF::setAlwaysZeroRandomSourceForTesting(); |
| 62 WTF::initialize(CurrentTime, CurrentTime, nullptr); | 65 WTF::initialize(CurrentTime, CurrentTime, nullptr); |
| 63 WTF::initializeMainThread(0); | 66 WTF::initializeMainThread(0); |
| 64 | 67 |
| 65 blink::TestingPlatformSupport::Config platformConfig; | 68 blink::TestingPlatformSupport::Config platformConfig; |
| 66 cc_blink::WebCompositorSupportImpl compositorSupport; | 69 cc_blink::WebCompositorSupportImpl compositorSupport; |
| 67 platformConfig.compositorSupport = &compositorSupport; | 70 platformConfig.compositorSupport = &compositorSupport; |
| 68 blink::TestingPlatformSupport platform(platformConfig); | 71 blink::TestingPlatformSupport platform(platformConfig); |
| 69 | 72 |
| 70 blink::Heap::init(); | 73 blink::Heap::init(); |
| 71 blink::ThreadState::attachMainThread(); | 74 blink::ThreadState::attachMainThread(); |
| 72 blink::ThreadState::current()->registerTraceDOMWrappers(nullptr, nullptr); | 75 blink::ThreadState::current()->registerTraceDOMWrappers(nullptr, nullptr); |
| 73 blink::EventTracer::initialize(); | 76 blink::EventTracer::initialize(); |
| 74 | 77 |
| 75 blink::HTTPNames::init(); | 78 blink::HTTPNames::init(); |
| 76 | 79 |
| 77 base::TestSuite testSuite(argc, argv); | 80 base::TestSuite testSuite(argc, argv); |
| 78 int result = base::LaunchUnitTests(argc, argv, base::Bind(runTestSuite, base
::Unretained(&testSuite))); | 81 int result = base::LaunchUnitTests(argc, argv, base::Bind(runTestSuite, base
::Unretained(&testSuite))); |
| 79 | 82 |
| 80 blink::ThreadState::detachMainThread(); | 83 blink::ThreadState::detachMainThread(); |
| 81 blink::Heap::shutdown(); | 84 blink::Heap::shutdown(); |
| 82 | 85 |
| 83 WTF::shutdown(); | 86 WTF::shutdown(); |
| 84 WTF::Partitions::shutdown(); | 87 WTF::Partitions::shutdown(); |
| 85 return result; | 88 return result; |
| 86 } | 89 } |
| OLD | NEW |