OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/media/webrtc/desktop_media_list_ash.h" | 5 #include "chrome/browser/media/webrtc/desktop_media_list_ash.h" |
6 | 6 |
7 #include "ash/test/ash_test_base.h" | 7 #include "ash/test/ash_test_base.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 MOCK_METHOD2(OnSourceNameChanged, void(DesktopMediaList* list, int index)); | 31 MOCK_METHOD2(OnSourceNameChanged, void(DesktopMediaList* list, int index)); |
32 MOCK_METHOD2(OnSourceThumbnailChanged, | 32 MOCK_METHOD2(OnSourceThumbnailChanged, |
33 void(DesktopMediaList* list, int index)); | 33 void(DesktopMediaList* list, int index)); |
34 }; | 34 }; |
35 | 35 |
36 class DesktopMediaListAshTest : public ash::test::AshTestBase { | 36 class DesktopMediaListAshTest : public ash::test::AshTestBase { |
37 public: | 37 public: |
38 DesktopMediaListAshTest() {} | 38 DesktopMediaListAshTest() {} |
39 ~DesktopMediaListAshTest() override {} | 39 ~DesktopMediaListAshTest() override {} |
40 | 40 |
| 41 void TearDown() override { |
| 42 // Reset the unique_ptr so the list stops refreshing. |
| 43 list_.reset(); |
| 44 ash::test::AshTestBase::TearDown(); |
| 45 } |
| 46 |
41 void CreateList(int source_types) { | 47 void CreateList(int source_types) { |
42 list_.reset(new DesktopMediaListAsh(source_types)); | 48 list_.reset(new DesktopMediaListAsh(source_types)); |
43 list_->SetThumbnailSize(gfx::Size(kThumbnailSize, kThumbnailSize)); | 49 list_->SetThumbnailSize(gfx::Size(kThumbnailSize, kThumbnailSize)); |
44 | 50 |
45 // Set update period to reduce the time it takes to run tests. | 51 // Set update period to reduce the time it takes to run tests. |
46 list_->SetUpdatePeriod(base::TimeDelta::FromMilliseconds(1)); | 52 list_->SetUpdatePeriod(base::TimeDelta::FromMilliseconds(1)); |
47 } | 53 } |
48 | 54 |
49 protected: | 55 protected: |
50 MockDesktopMediaListObserver observer_; | 56 MockDesktopMediaListObserver observer_; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 .WillOnce(QuitMessageLoop()) | 119 .WillOnce(QuitMessageLoop()) |
114 .WillRepeatedly(DoDefault()); | 120 .WillRepeatedly(DoDefault()); |
115 EXPECT_CALL(observer_, OnSourceRemoved(list_.get(), 0)) | 121 EXPECT_CALL(observer_, OnSourceRemoved(list_.get(), 0)) |
116 .WillOnce(QuitMessageLoop()); | 122 .WillOnce(QuitMessageLoop()); |
117 | 123 |
118 list_->StartUpdating(&observer_); | 124 list_->StartUpdating(&observer_); |
119 base::RunLoop().Run(); | 125 base::RunLoop().Run(); |
120 window.reset(); | 126 window.reset(); |
121 base::RunLoop().Run(); | 127 base::RunLoop().Run(); |
122 } | 128 } |
OLD | NEW |