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/ScriptLoader.h" | 9 #include "core/dom/ScriptLoader.h" |
| 10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 375 EXPECT_THAT(m_order, ElementsAre(1)); | 375 EXPECT_THAT(m_order, ElementsAre(1)); |
| 376 | 376 |
| 377 // Make sure the interrupted tasks are executed next 'tick'. | 377 // Make sure the interrupted tasks are executed next 'tick'. |
| 378 m_platform.setShouldYield(false); | 378 m_platform.setShouldYield(false); |
| 379 m_platform.runSingleTask(); | 379 m_platform.runSingleTask(); |
| 380 EXPECT_THAT(m_order, ElementsAre(1, 2, 3)); | 380 EXPECT_THAT(m_order, ElementsAre(1, 2, 3)); |
| 381 } | 381 } |
| 382 | 382 |
| 383 TEST_F(ScriptRunnerTest, QueueReentrantScript_ManyAsyncScripts) | 383 TEST_F(ScriptRunnerTest, QueueReentrantScript_ManyAsyncScripts) |
| 384 { | 384 { |
| 385 OwnPtr<MockScriptLoader> scriptLoaders[20]; | 385 OwnPtrWillBeRawPtr<MockScriptLoader> scriptLoaders[20]; |
| 386 for (int i = 0; i < 20; i++) | |
| 387 scriptLoaders[i] = nullptr; | |
|
haraken
2015/03/20 14:07:42
What is this nullptr assignment for?
sof
2015/03/20 14:15:16
Being tidy wrt RawPtr<> zero initialization, nothi
| |
| 388 | |
| 386 for (int i = 0; i < 20; i++) { | 389 for (int i = 0; i < 20; i++) { |
| 387 scriptLoaders[i] = adoptPtr(new MockScriptLoader(m_element.get())); | 390 scriptLoaders[i] = adoptPtrWillBeNoop(new MockScriptLoader(m_element.get ())); |
| 388 EXPECT_CALL(*scriptLoaders[i], isReady()).WillRepeatedly(Return(true)); | 391 EXPECT_CALL(*scriptLoaders[i], isReady()).WillRepeatedly(Return(true)); |
| 389 | 392 |
| 390 m_scriptRunner->queueScriptForExecution(scriptLoaders[i].get(), ScriptRu nner::ASYNC_EXECUTION); | 393 m_scriptRunner->queueScriptForExecution(scriptLoaders[i].get(), ScriptRu nner::ASYNC_EXECUTION); |
| 391 | 394 |
| 392 if (i > 0) { | 395 if (i > 0) { |
| 393 EXPECT_CALL(*scriptLoaders[i], execute()).WillOnce(Invoke([this, i] { | 396 EXPECT_CALL(*scriptLoaders[i], execute()).WillOnce(Invoke([this, i] { |
| 394 m_order.push_back(i); | 397 m_order.push_back(i); |
| 395 })); | 398 })); |
| 396 } | 399 } |
| 397 } | 400 } |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 506 testing::Mock::VerifyAndClear(&scriptLoader2); | 509 testing::Mock::VerifyAndClear(&scriptLoader2); |
| 507 testing::Mock::VerifyAndClear(&scriptLoader3); | 510 testing::Mock::VerifyAndClear(&scriptLoader3); |
| 508 EXPECT_CALL(scriptLoader2, execute()).Times(1); | 511 EXPECT_CALL(scriptLoader2, execute()).Times(1); |
| 509 EXPECT_CALL(scriptLoader3, execute()).Times(1); | 512 EXPECT_CALL(scriptLoader3, execute()).Times(1); |
| 510 EXPECT_CALL(scriptLoader2, isReady()).WillRepeatedly(Return(true)); | 513 EXPECT_CALL(scriptLoader2, isReady()).WillRepeatedly(Return(true)); |
| 511 EXPECT_CALL(scriptLoader3, isReady()).WillRepeatedly(Return(true)); | 514 EXPECT_CALL(scriptLoader3, isReady()).WillRepeatedly(Return(true)); |
| 512 m_platform.runAllTasks(); | 515 m_platform.runAllTasks(); |
| 513 } | 516 } |
| 514 | 517 |
| 515 } // namespace blink | 518 } // namespace blink |
| OLD | NEW |