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

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: Rebased Created 5 years, 8 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
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/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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698