| 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 "core/dom/ScriptRunner.h" | 5 #include "core/dom/ScriptRunner.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/dom/Element.h" | 8 #include "core/dom/Element.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 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 private: | 36 private: |
| 37 explicit MockScriptLoader(Element* element) | 37 explicit MockScriptLoader(Element* element) |
| 38 : ScriptLoader(element, false, false, false) {} | 38 : ScriptLoader(element, false, false, false) {} |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 class ScriptRunnerTest : public testing::Test { | 41 class ScriptRunnerTest : public testing::Test { |
| 42 public: | 42 public: |
| 43 ScriptRunnerTest() | 43 ScriptRunnerTest() |
| 44 : m_document(Document::create()), | 44 : m_document(Document::create()), |
| 45 m_element(m_document->createElement("foo", ASSERT_NO_EXCEPTION)) {} | 45 m_element(m_document->createElement("foo")) {} |
| 46 | 46 |
| 47 void SetUp() override { | 47 void SetUp() override { |
| 48 // We have to create ScriptRunner after initializing platform, because we | 48 // We have to create ScriptRunner after initializing platform, because we |
| 49 // need Platform::current()->currentThread()->scheduler()-> | 49 // need Platform::current()->currentThread()->scheduler()-> |
| 50 // loadingTaskRunner() to be initialized before creating ScriptRunner to | 50 // loadingTaskRunner() to be initialized before creating ScriptRunner to |
| 51 // save it in constructor. | 51 // save it in constructor. |
| 52 m_scriptRunner = ScriptRunner::create(m_document.get()); | 52 m_scriptRunner = ScriptRunner::create(m_document.get()); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void TearDown() override { m_scriptRunner.release(); } | 55 void TearDown() override { m_scriptRunner.release(); } |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 | 415 |
| 416 // m_scriptRunner is gone. We need to make sure that ScriptRunner::Task do not | 416 // m_scriptRunner is gone. We need to make sure that ScriptRunner::Task do not |
| 417 // access dead object. | 417 // access dead object. |
| 418 EXPECT_CALL(*scriptLoader1, execute()).Times(0); | 418 EXPECT_CALL(*scriptLoader1, execute()).Times(0); |
| 419 EXPECT_CALL(*scriptLoader2, execute()).Times(0); | 419 EXPECT_CALL(*scriptLoader2, execute()).Times(0); |
| 420 | 420 |
| 421 m_platform.runUntilIdle(); | 421 m_platform.runUntilIdle(); |
| 422 } | 422 } |
| 423 | 423 |
| 424 } // namespace blink | 424 } // namespace blink |
| OLD | NEW |