Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "config.h" | 5 #include "config.h" |
| 6 #include "core/dom/ScriptRunner.h" | 6 #include "core/dom/ScriptRunner.h" |
| 7 | 7 |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/dom/Element.h" | 9 #include "core/dom/Element.h" |
| 10 #include "core/dom/ScriptLoader.h" | 10 #include "core/dom/ScriptLoader.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 private: | 79 private: |
| 80 Deque<OwnPtr<WebThread::Task>> m_tasks; | 80 Deque<OwnPtr<WebThread::Task>> m_tasks; |
| 81 bool m_shouldYield; | 81 bool m_shouldYield; |
| 82 bool m_shouldYieldEveryOtherTime; | 82 bool m_shouldYieldEveryOtherTime; |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 class ScriptRunnerTest : public testing::Test { | 85 class ScriptRunnerTest : public testing::Test { |
| 86 public: | 86 public: |
| 87 void SetUp() override | 87 void SetUp() override |
| 88 { | 88 { |
| 89 Scheduler::shutdown(); | |
|
Sami
2015/04/09 10:52:29
Why is this change needed?
alex clarke (OOO till 29th)
2015/04/10 15:29:34
I think this was due to some shutdown problems. F
| |
| 90 | |
| 91 m_oldPlatform = Platform::current(); | |
| 92 Platform::initialize(&m_platform); | |
| 89 m_document = Document::create(); | 93 m_document = Document::create(); |
| 90 m_element = m_document->createElement("foo", ASSERT_NO_EXCEPTION); | 94 m_element = m_document->createElement("foo", ASSERT_NO_EXCEPTION); |
| 91 | 95 |
| 92 m_scriptRunner = ScriptRunner::create(m_document.get()); | 96 m_scriptRunner = ScriptRunner::create(m_document.get()); |
| 93 m_oldPlatform = Platform::current(); | 97 m_oldPlatform = Platform::current(); |
| 94 m_oldScheduler = Scheduler::shared(); | 98 m_oldScheduler = Scheduler::shared(); |
| 95 | 99 |
| 96 // Force Platform::initialize to create a new one pointing at MockPlatfo rm. | 100 // Force Platform::initialize to create a new one pointing at MockPlatfo rm. |
| 97 Scheduler::setForTesting(nullptr); | 101 Scheduler::setForTesting(nullptr); |
| 98 Platform::initialize(&m_platform); | 102 Platform::initialize(&m_platform); |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 508 testing::Mock::VerifyAndClear(&scriptLoader2); | 512 testing::Mock::VerifyAndClear(&scriptLoader2); |
| 509 testing::Mock::VerifyAndClear(&scriptLoader3); | 513 testing::Mock::VerifyAndClear(&scriptLoader3); |
| 510 EXPECT_CALL(scriptLoader2, execute()).Times(1); | 514 EXPECT_CALL(scriptLoader2, execute()).Times(1); |
| 511 EXPECT_CALL(scriptLoader3, execute()).Times(1); | 515 EXPECT_CALL(scriptLoader3, execute()).Times(1); |
| 512 EXPECT_CALL(scriptLoader2, isReady()).WillRepeatedly(Return(true)); | 516 EXPECT_CALL(scriptLoader2, isReady()).WillRepeatedly(Return(true)); |
| 513 EXPECT_CALL(scriptLoader3, isReady()).WillRepeatedly(Return(true)); | 517 EXPECT_CALL(scriptLoader3, isReady()).WillRepeatedly(Return(true)); |
| 514 m_platform.runAllTasks(); | 518 m_platform.runAllTasks(); |
| 515 } | 519 } |
| 516 | 520 |
| 517 } // namespace blink | 521 } // namespace blink |
| OLD | NEW |