Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(623)

Side by Side Diff: Source/core/dom/ScriptRunnerTest.cpp

Issue 956333002: Refactor TimeBase to post tasks. Workers to use real Idle tasks. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix a bunch of stuff Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/Init.cpp ('k') | Source/core/frame/DOMTimerCoordinator.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/ScriptLoader.h" 9 #include "core/dom/ScriptLoader.h"
10 #include "platform/heap/Handle.h" 10 #include "platform/heap/Handle.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 private: 80 private:
81 Deque<OwnPtr<WebThread::Task>> m_tasks; 81 Deque<OwnPtr<WebThread::Task>> m_tasks;
82 bool m_shouldYield; 82 bool m_shouldYield;
83 bool m_shouldYieldEveryOtherTime; 83 bool m_shouldYieldEveryOtherTime;
84 }; 84 };
85 85
86 class ScriptRunnerTest : public testing::Test { 86 class ScriptRunnerTest : public testing::Test {
87 public: 87 public:
88 void SetUp() override 88 void SetUp() override
89 { 89 {
90 Scheduler::shutdown();
Sami 2015/02/27 18:29:52 I wonder if we should have some testing helper for
91
92 m_oldPlatform = Platform::current();
93 Platform::initialize(&m_platform);
90 m_document = Document::create(); 94 m_document = Document::create();
91 m_element = m_document->createElement("foo", ASSERT_NO_EXCEPTION); 95 m_element = m_document->createElement("foo", ASSERT_NO_EXCEPTION);
92 96
93 m_scriptRunner = ScriptRunner::create(m_document.get()); 97 m_scriptRunner = ScriptRunner::create(m_document.get());
94 m_oldPlatform = Platform::current();
95 Platform::initialize(&m_platform);
96 m_platform.setShouldYield(false); 98 m_platform.setShouldYield(false);
97 m_platform.setShouldYieldEveryOtherTime(false); 99 m_platform.setShouldYieldEveryOtherTime(false);
98 } 100 }
99 101
100 void TearDown() override 102 void TearDown() override
101 { 103 {
102 m_scriptRunner.release(); 104 m_scriptRunner.release();
103 Scheduler::shutdown(); 105 Scheduler::shutdown();
104 Platform::initialize(m_oldPlatform); 106 Platform::initialize(m_oldPlatform);
105 } 107 }
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 461
460 // We can't safely distruct ScriptRunner with unexecuted MockScriptLoaders ( real ScriptLoader is fine) so drain them. 462 // We can't safely distruct ScriptRunner with unexecuted MockScriptLoaders ( real ScriptLoader is fine) so drain them.
461 testing::Mock::VerifyAndClear(&scriptLoader2); 463 testing::Mock::VerifyAndClear(&scriptLoader2);
462 testing::Mock::VerifyAndClear(&scriptLoader3); 464 testing::Mock::VerifyAndClear(&scriptLoader3);
463 EXPECT_CALL(scriptLoader2, isReady()).WillRepeatedly(Return(true)); 465 EXPECT_CALL(scriptLoader2, isReady()).WillRepeatedly(Return(true));
464 EXPECT_CALL(scriptLoader3, isReady()).WillRepeatedly(Return(true)); 466 EXPECT_CALL(scriptLoader3, isReady()).WillRepeatedly(Return(true));
465 m_platform.runAllTasks(); 467 m_platform.runAllTasks();
466 } 468 }
467 469
468 } // namespace blink 470 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/Init.cpp ('k') | Source/core/frame/DOMTimerCoordinator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698