| 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 "core/timing/PerformanceObserver.h" | 5 #include "core/timing/PerformanceObserver.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/PerformanceObserverCallback.h" | 7 #include "bindings/core/v8/PerformanceObserverCallback.h" |
| 8 #include "bindings/core/v8/V8BindingForTesting.h" | 8 #include "bindings/core/v8/V8BindingForTesting.h" |
| 9 #include "core/timing/Performance.h" | 9 #include "core/timing/Performance.h" |
| 10 #include "core/timing/PerformanceBase.h" | 10 #include "core/timing/PerformanceBase.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 Persistent<PerformanceObserver> m_observer; | 44 Persistent<PerformanceObserver> m_observer; |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 TEST_F(PerformanceObserverTest, Observe) { | 47 TEST_F(PerformanceObserverTest, Observe) { |
| 48 V8TestingScope scope; | 48 V8TestingScope scope; |
| 49 initialize(scope.getScriptState()); | 49 initialize(scope.getScriptState()); |
| 50 | 50 |
| 51 NonThrowableExceptionState exceptionState; | 51 NonThrowableExceptionState exceptionState; |
| 52 PerformanceObserverInit options; | 52 PerformanceObserverInit options; |
| 53 Vector<String> entryTypeVec; | 53 Vector<String> entryTypeVec; |
| 54 entryTypeVec.append("mark"); | 54 entryTypeVec.push_back("mark"); |
| 55 options.setEntryTypes(entryTypeVec); | 55 options.setEntryTypes(entryTypeVec); |
| 56 | 56 |
| 57 m_observer->observe(options, exceptionState); | 57 m_observer->observe(options, exceptionState); |
| 58 EXPECT_TRUE(isRegistered()); | 58 EXPECT_TRUE(isRegistered()); |
| 59 } | 59 } |
| 60 | 60 |
| 61 TEST_F(PerformanceObserverTest, Enqueue) { | 61 TEST_F(PerformanceObserverTest, Enqueue) { |
| 62 V8TestingScope scope; | 62 V8TestingScope scope; |
| 63 initialize(scope.getScriptState()); | 63 initialize(scope.getScriptState()); |
| 64 | 64 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 91 EXPECT_EQ(0, numPerformanceEntries()); | 91 EXPECT_EQ(0, numPerformanceEntries()); |
| 92 | 92 |
| 93 m_observer->enqueuePerformanceEntry(*entry); | 93 m_observer->enqueuePerformanceEntry(*entry); |
| 94 EXPECT_EQ(1, numPerformanceEntries()); | 94 EXPECT_EQ(1, numPerformanceEntries()); |
| 95 | 95 |
| 96 m_observer->disconnect(); | 96 m_observer->disconnect(); |
| 97 EXPECT_FALSE(isRegistered()); | 97 EXPECT_FALSE(isRegistered()); |
| 98 EXPECT_EQ(0, numPerformanceEntries()); | 98 EXPECT_EQ(0, numPerformanceEntries()); |
| 99 } | 99 } |
| 100 } | 100 } |
| OLD | NEW |