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 "modules/presentation/PresentationAvailability.h" | 5 #include "modules/presentation/PresentationAvailability.h" |
6 | 6 |
| 7 #include <v8.h> |
7 #include "bindings/core/v8/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
8 #include "bindings/core/v8/V8BindingForTesting.h" | 9 #include "bindings/core/v8/V8BindingForTesting.h" |
9 #include "core/dom/DOMException.h" | 10 #include "core/dom/DOMException.h" |
10 #include "core/frame/LocalFrame.h" | 11 #include "core/frame/LocalFrame.h" |
11 #include "core/page/Page.h" | 12 #include "core/page/Page.h" |
12 #include "core/testing/DummyPageHolder.h" | 13 #include "core/testing/DummyPageHolder.h" |
13 #include "modules/presentation/PresentationRequest.h" | 14 #include "modules/presentation/PresentationRequest.h" |
14 #include "platform/testing/URLTestHelpers.h" | 15 #include "platform/testing/URLTestHelpers.h" |
15 #include "platform/weborigin/KURL.h" | 16 #include "platform/weborigin/KURL.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
17 #include "wtf/Vector.h" | 18 #include "wtf/Vector.h" |
18 #include <v8.h> | |
19 | 19 |
20 namespace blink { | 20 namespace blink { |
21 namespace { | 21 namespace { |
22 | 22 |
23 TEST(PresentationAvailabilityTest, NoPageVisibilityChangeAfterDetach) { | 23 TEST(PresentationAvailabilityTest, NoPageVisibilityChangeAfterDetach) { |
24 V8TestingScope scope; | 24 V8TestingScope scope; |
25 WTF::Vector<KURL> urls; | 25 WTF::Vector<KURL> urls; |
26 urls.push_back(URLTestHelpers::toKURL("https://example.com")); | 26 urls.push_back(URLTestHelpers::toKURL("https://example.com")); |
27 urls.push_back(URLTestHelpers::toKURL("https://another.com")); | 27 urls.push_back(URLTestHelpers::toKURL("https://another.com")); |
28 | 28 |
29 Persistent<PresentationAvailabilityProperty> resolver = | 29 Persistent<PresentationAvailabilityProperty> resolver = |
30 new PresentationAvailabilityProperty( | 30 new PresentationAvailabilityProperty( |
31 scope.getExecutionContext(), nullptr, | 31 scope.getExecutionContext(), nullptr, |
32 PresentationAvailabilityProperty::Ready); | 32 PresentationAvailabilityProperty::Ready); |
33 Persistent<PresentationAvailability> availability = | 33 Persistent<PresentationAvailability> availability = |
34 PresentationAvailability::take(resolver, urls, false); | 34 PresentationAvailability::take(resolver, urls, false); |
35 | 35 |
36 // These two calls should not crash. | 36 // These two calls should not crash. |
37 scope.frame().detach(FrameDetachType::Remove); | 37 scope.frame().detach(FrameDetachType::Remove); |
38 scope.page().setVisibilityState(PageVisibilityStateHidden, false); | 38 scope.page().setVisibilityState(PageVisibilityStateHidden, false); |
39 } | 39 } |
40 | 40 |
41 } // anonymous namespace | 41 } // anonymous namespace |
42 } // namespace blink | 42 } // namespace blink |
OLD | NEW |