OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/css/MediaQueryList.h" | 5 #include "core/css/MediaQueryList.h" |
6 | 6 |
7 #include "core/css/MediaList.h" | 7 #include "core/css/MediaList.h" |
8 #include "core/css/MediaQueryListListener.h" | 8 #include "core/css/MediaQueryListListener.h" |
9 #include "core/css/MediaQueryMatcher.h" | 9 #include "core/css/MediaQueryMatcher.h" |
10 #include "core/dom/Document.h" | 10 #include "core/dom/Document.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 class TestListener : public MediaQueryListListener { | 17 class TestListener : public MediaQueryListListener { |
18 public: | 18 public: |
19 void notifyMediaQueryChanged() override { } | 19 void notifyMediaQueryChanged() override { } |
20 }; | 20 }; |
21 | 21 |
22 } // anonymous namespace | 22 } // anonymous namespace |
23 | 23 |
24 TEST(MediaQueryListTest, CrashInStop) | 24 TEST(MediaQueryListTest, CrashInStop) |
25 { | 25 { |
26 RawPtr<Document> document = Document::create(); | 26 Document* document = Document::create(); |
27 RawPtr<MediaQueryList> list = MediaQueryList::create(document.get(), MediaQu
eryMatcher::create(*document), MediaQuerySet::create()); | 27 MediaQueryList* list = MediaQueryList::create(document, MediaQueryMatcher::c
reate(*document), MediaQuerySet::create()); |
28 list->addListener(new TestListener()); | 28 list->addListener(new TestListener()); |
29 list->stop(); | 29 list->stop(); |
30 // This test passes if it's not crashed. | 30 // This test passes if it's not crashed. |
31 } | 31 } |
32 | 32 |
33 } // namespace blink | 33 } // namespace blink |
OLD | NEW |