OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <memory> |
5 #include "core/events/MessageEvent.h" | 6 #include "core/events/MessageEvent.h" |
6 #include "core/inspector/ConsoleMessageStorage.h" | 7 #include "core/inspector/ConsoleMessageStorage.h" |
7 #include "core/testing/DummyPageHolder.h" | 8 #include "core/testing/DummyPageHolder.h" |
8 #include "core/workers/DedicatedWorkerGlobalScope.h" | 9 #include "core/workers/DedicatedWorkerGlobalScope.h" |
9 #include "core/workers/DedicatedWorkerThread.h" | 10 #include "core/workers/DedicatedWorkerThread.h" |
10 #include "core/workers/InProcessWorkerMessagingProxy.h" | 11 #include "core/workers/InProcessWorkerMessagingProxy.h" |
11 #include "core/workers/InProcessWorkerObjectProxy.h" | 12 #include "core/workers/InProcessWorkerObjectProxy.h" |
12 #include "core/workers/WorkerInspectorProxy.h" | 13 #include "core/workers/WorkerInspectorProxy.h" |
13 #include "core/workers/WorkerThread.h" | 14 #include "core/workers/WorkerThread.h" |
14 #include "core/workers/WorkerThreadStartupData.h" | 15 #include "core/workers/WorkerThreadStartupData.h" |
15 #include "core/workers/WorkerThreadTestHelper.h" | 16 #include "core/workers/WorkerThreadTestHelper.h" |
16 #include "platform/CrossThreadFunctional.h" | 17 #include "platform/CrossThreadFunctional.h" |
17 #include "platform/testing/UnitTestHelpers.h" | 18 #include "platform/testing/UnitTestHelpers.h" |
18 #include "testing/gmock/include/gmock/gmock.h" | 19 #include "testing/gmock/include/gmock/gmock.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
20 #include <memory> | |
21 | 21 |
22 namespace blink { | 22 namespace blink { |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 // These are chosen by trial-and-error. Making these intervals smaller causes | 26 // These are chosen by trial-and-error. Making these intervals smaller causes |
27 // test flakiness. The main thread needs to wait until message confirmation and | 27 // test flakiness. The main thread needs to wait until message confirmation and |
28 // activity report separately. If the intervals are very short, they are | 28 // activity report separately. If the intervals are very short, they are |
29 // notified to the main thread almost at the same time and the thread may miss | 29 // notified to the main thread almost at the same time and the thread may miss |
30 // the second notification. | 30 // the second notification. |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 EXPECT_FALSE(UseCounter::isCounted(document(), feature2)); | 400 EXPECT_FALSE(UseCounter::isCounted(document(), feature2)); |
401 workerThread()->postTask( | 401 workerThread()->postTask( |
402 BLINK_FROM_HERE, | 402 BLINK_FROM_HERE, |
403 crossThreadBind(&DedicatedWorkerThreadForTest::countDeprecation, | 403 crossThreadBind(&DedicatedWorkerThreadForTest::countDeprecation, |
404 crossThreadUnretained(workerThread()), feature2)); | 404 crossThreadUnretained(workerThread()), feature2)); |
405 testing::enterRunLoop(); | 405 testing::enterRunLoop(); |
406 EXPECT_TRUE(UseCounter::isCounted(document(), feature2)); | 406 EXPECT_TRUE(UseCounter::isCounted(document(), feature2)); |
407 } | 407 } |
408 | 408 |
409 } // namespace blink | 409 } // namespace blink |
OLD | NEW |