| 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 23 matching lines...) Expand all Loading... |
| 34 #include "mojo/edk/embedder/embedder.h" | 34 #include "mojo/edk/embedder/embedder.h" |
| 35 #include "mojo/edk/test/scoped_ipc_support.h" | 35 #include "mojo/edk/test/scoped_ipc_support.h" |
| 36 #include "platform/EventTracer.h" | 36 #include "platform/EventTracer.h" |
| 37 #include "platform/HTTPNames.h" | 37 #include "platform/HTTPNames.h" |
| 38 #include "platform/graphics/CompositorFactory.h" | 38 #include "platform/graphics/CompositorFactory.h" |
| 39 #include "platform/heap/Heap.h" | 39 #include "platform/heap/Heap.h" |
| 40 #include "platform/testing/TestingPlatformSupport.h" | 40 #include "platform/testing/TestingPlatformSupport.h" |
| 41 #include "public/platform/Platform.h" | 41 #include "public/platform/Platform.h" |
| 42 #include "wtf/CryptographicallyRandomNumber.h" | 42 #include "wtf/CryptographicallyRandomNumber.h" |
| 43 #include "wtf/CurrentTime.h" | 43 #include "wtf/CurrentTime.h" |
| 44 #include "wtf/MainThread.h" | |
| 45 #include "wtf/Partitions.h" | 44 #include "wtf/Partitions.h" |
| 46 #include "wtf/WTF.h" | 45 #include "wtf/WTF.h" |
| 47 #include <base/bind.h> | 46 #include <base/bind.h> |
| 48 #include <base/bind_helpers.h> | 47 #include <base/bind_helpers.h> |
| 49 #include <base/command_line.h> | 48 #include <base/command_line.h> |
| 50 #include <base/test/launcher/unit_test_launcher.h> | 49 #include <base/test/launcher/unit_test_launcher.h> |
| 51 #include <base/test/test_suite.h> | 50 #include <base/test/test_suite.h> |
| 52 #include <cc/blink/web_compositor_support_impl.h> | 51 #include <cc/blink/web_compositor_support_impl.h> |
| 53 | 52 |
| 54 namespace { | 53 namespace { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 77 base::CommandLine::Init(argc, argv); | 76 base::CommandLine::Init(argc, argv); |
| 78 | 77 |
| 79 base::TestDiscardableMemoryAllocator discardableMemoryAllocator; | 78 base::TestDiscardableMemoryAllocator discardableMemoryAllocator; |
| 80 base::DiscardableMemoryAllocator::SetInstance(&discardableMemoryAllocator); | 79 base::DiscardableMemoryAllocator::SetInstance(&discardableMemoryAllocator); |
| 81 | 80 |
| 82 OwnPtr<DummyPlatform> platform = adoptPtr(new DummyPlatform); | 81 OwnPtr<DummyPlatform> platform = adoptPtr(new DummyPlatform); |
| 83 blink::Platform::setCurrentPlatformForTesting(platform.get()); | 82 blink::Platform::setCurrentPlatformForTesting(platform.get()); |
| 84 | 83 |
| 85 WTF::Partitions::initialize(nullptr); | 84 WTF::Partitions::initialize(nullptr); |
| 86 WTF::setTimeFunctionsForTesting(dummyCurrentTime); | 85 WTF::setTimeFunctionsForTesting(dummyCurrentTime); |
| 87 WTF::initialize(); | 86 WTF::initialize(nullptr); |
| 88 WTF::initializeMainThread(0); | |
| 89 blink::CompositorFactory::initializeDefault(); | 87 blink::CompositorFactory::initializeDefault(); |
| 90 int result = 0; | 88 int result = 0; |
| 91 { | 89 { |
| 92 blink::TestingPlatformSupport::Config platformConfig; | 90 blink::TestingPlatformSupport::Config platformConfig; |
| 93 cc_blink::WebCompositorSupportImpl compositorSupport; | 91 cc_blink::WebCompositorSupportImpl compositorSupport; |
| 94 platformConfig.compositorSupport = &compositorSupport; | 92 platformConfig.compositorSupport = &compositorSupport; |
| 95 blink::TestingPlatformSupport platform(platformConfig); | 93 blink::TestingPlatformSupport platform(platformConfig); |
| 96 | 94 |
| 97 blink::Heap::init(); | 95 blink::Heap::init(); |
| 98 blink::ThreadState::attachMainThread(); | 96 blink::ThreadState::attachMainThread(); |
| 99 blink::ThreadState::current()->registerTraceDOMWrappers(nullptr, nullptr
); | 97 blink::ThreadState::current()->registerTraceDOMWrappers(nullptr, nullptr
); |
| 100 blink::EventTracer::initialize(); | 98 blink::EventTracer::initialize(); |
| 101 blink::HTTPNames::init(); | 99 blink::HTTPNames::init(); |
| 102 | 100 |
| 103 base::TestSuite testSuite(argc, argv); | 101 base::TestSuite testSuite(argc, argv); |
| 104 | 102 |
| 105 mojo::edk::Init(); | 103 mojo::edk::Init(); |
| 106 base::TestIOThread testIoThread(base::TestIOThread::kAutoStart); | 104 base::TestIOThread testIoThread(base::TestIOThread::kAutoStart); |
| 107 WTF::OwnPtr<mojo::edk::test::ScopedIPCSupport> ipcSupport(adoptPtr(new m
ojo::edk::test::ScopedIPCSupport(testIoThread.task_runner()))); | 105 WTF::OwnPtr<mojo::edk::test::ScopedIPCSupport> ipcSupport(adoptPtr(new m
ojo::edk::test::ScopedIPCSupport(testIoThread.task_runner()))); |
| 108 result = base::LaunchUnitTests(argc, argv, base::Bind(runTestSuite, base
::Unretained(&testSuite))); | 106 result = base::LaunchUnitTests(argc, argv, base::Bind(runTestSuite, base
::Unretained(&testSuite))); |
| 109 | 107 |
| 110 blink::ThreadState::detachMainThread(); | 108 blink::ThreadState::detachMainThread(); |
| 111 blink::Heap::shutdown(); | 109 blink::Heap::shutdown(); |
| 112 } | 110 } |
| 113 blink::CompositorFactory::shutdown(); | 111 blink::CompositorFactory::shutdown(); |
| 114 WTF::shutdown(); | 112 WTF::shutdown(); |
| 115 WTF::Partitions::shutdown(); | 113 WTF::Partitions::shutdown(); |
| 116 return result; | 114 return result; |
| 117 } | 115 } |
| OLD | NEW |