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