Chromium Code Reviews| Index: mojo/public/cpp/bindings/tests/wtf_test_base.cc |
| diff --git a/mojo/public/cpp/bindings/tests/wtf_test_base.cc b/mojo/public/cpp/bindings/tests/wtf_test_base.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..086946eac121d4785ac10f7021485a19459958db |
| --- /dev/null |
| +++ b/mojo/public/cpp/bindings/tests/wtf_test_base.cc |
| @@ -0,0 +1,40 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "mojo/public/cpp/bindings/tests/wtf_test_base.h" |
| + |
| +#include "third_party/WebKit/Source/wtf/CurrentTime.h" |
| +#include "third_party/WebKit/Source/wtf/MainThread.h" |
| +#include "third_party/WebKit/Source/wtf/Partitions.h" |
| +#include "third_party/WebKit/Source/wtf/WTF.h" |
| + |
| +namespace mojo { |
| +namespace test { |
| +namespace { |
| + |
| +double DummyGetCurrentTime() { |
| + return 0.0; |
| +} |
| + |
| +bool g_wtf_initialized = false; |
| + |
| +} // namespace |
| + |
| +WTFTestBase::~WTFTestBase() {} |
| + |
| +WTFTestBase::WTFTestBase() {} |
| + |
| +void WTFTestBase::SetUp() { |
| + if (g_wtf_initialized) |
| + return; |
| + |
| + WTF::Partitions::initialize(nullptr); |
| + WTF::setTimeFunctionsForTesting(DummyGetCurrentTime); |
| + WTF::initialize(nullptr); |
| + WTF::initializeMainThread(0); |
| + g_wtf_initialized = true; |
|
haraken
2016/03/07 23:54:17
Can we use blink::initializeWithoutV8/shutdownWith
yzshen1
2016/03/08 00:17:09
I tried it, but that requires to link against the
haraken
2016/03/08 00:29:29
Then can we add a public API (in public/platform/)
|
| +} |
| + |
| +} // namespace test |
| +} // namespace mojo |