OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/test/test_blink_web_unit_test_support.h" | 5 #include "content/test/test_blink_web_unit_test_support.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 88 |
89 url_loader_factory_.reset(new WebURLLoaderMockFactory()); | 89 url_loader_factory_.reset(new WebURLLoaderMockFactory()); |
90 mock_clipboard_.reset(new MockWebClipboardImpl()); | 90 mock_clipboard_.reset(new MockWebClipboardImpl()); |
91 | 91 |
92 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | 92 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
93 gin::V8Initializer::LoadV8Snapshot(); | 93 gin::V8Initializer::LoadV8Snapshot(); |
94 #endif | 94 #endif |
95 | 95 |
96 scoped_refptr<base::SingleThreadTaskRunner> dummy_task_runner; | 96 scoped_refptr<base::SingleThreadTaskRunner> dummy_task_runner; |
97 scoped_ptr<base::ThreadTaskRunnerHandle> dummy_task_runner_handle; | 97 scoped_ptr<base::ThreadTaskRunnerHandle> dummy_task_runner_handle; |
98 if (!base::MessageLoopProxy::current()) { | 98 if (!base::ThreadTaskRunnerHandle::IsSet()) { |
99 // Dummy task runner is initialized here because the blink::initialize | 99 // Dummy task runner is initialized here because the blink::initialize |
100 // creates IsolateHolder which needs the current task runner handle. There | 100 // creates IsolateHolder which needs the current task runner handle. There |
101 // should be no task posted to this task runner. The message loop is not | 101 // should be no task posted to this task runner. The message loop is not |
102 // created before this initialization because some tests need specific kinds | 102 // created before this initialization because some tests need specific kinds |
103 // of message loops, and their types are not known upfront. Some tests also | 103 // of message loops, and their types are not known upfront. Some tests also |
104 // create their own thread bundles or message loops, and doing the same in | 104 // create their own thread bundles or message loops, and doing the same in |
105 // TestBlinkWebUnitTestSupport would introduce a conflict. | 105 // TestBlinkWebUnitTestSupport would introduce a conflict. |
106 dummy_task_runner = make_scoped_refptr(new DummyTaskRunner()); | 106 dummy_task_runner = make_scoped_refptr(new DummyTaskRunner()); |
107 dummy_task_runner_handle.reset( | 107 dummy_task_runner_handle.reset( |
108 new base::ThreadTaskRunnerHandle(dummy_task_runner)); | 108 new base::ThreadTaskRunnerHandle(dummy_task_runner)); |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 DCHECK(base::MessageLoop::current()); | 374 DCHECK(base::MessageLoop::current()); |
375 DCHECK(!base::MessageLoop::current()->is_running()); | 375 DCHECK(!base::MessageLoop::current()->is_running()); |
376 base::MessageLoop::current()->Run(); | 376 base::MessageLoop::current()->Run(); |
377 } | 377 } |
378 | 378 |
379 void TestBlinkWebUnitTestSupport::exitRunLoop() { | 379 void TestBlinkWebUnitTestSupport::exitRunLoop() { |
380 base::MessageLoop::current()->Quit(); | 380 base::MessageLoop::current()->Quit(); |
381 } | 381 } |
382 | 382 |
383 } // namespace content | 383 } // namespace content |
OLD | NEW |