| 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 | |
| 47 void CreateList(int source_types) { | 41 void CreateList(int source_types) { |
| 48 list_.reset(new DesktopMediaListAsh(source_types)); | 42 list_.reset(new DesktopMediaListAsh(source_types)); |
| 49 list_->SetThumbnailSize(gfx::Size(kThumbnailSize, kThumbnailSize)); | 43 list_->SetThumbnailSize(gfx::Size(kThumbnailSize, kThumbnailSize)); |
| 50 | 44 |
| 51 // Set update period to reduce the time it takes to run tests. | 45 // Set update period to reduce the time it takes to run tests. |
| 52 list_->SetUpdatePeriod(base::TimeDelta::FromMilliseconds(1)); | 46 list_->SetUpdatePeriod(base::TimeDelta::FromMilliseconds(1)); |
| 53 } | 47 } |
| 54 | 48 |
| 55 protected: | 49 protected: |
| 56 MockDesktopMediaListObserver observer_; | 50 MockDesktopMediaListObserver observer_; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 .WillOnce(QuitMessageLoop()) | 113 .WillOnce(QuitMessageLoop()) |
| 120 .WillRepeatedly(DoDefault()); | 114 .WillRepeatedly(DoDefault()); |
| 121 EXPECT_CALL(observer_, OnSourceRemoved(list_.get(), 0)) | 115 EXPECT_CALL(observer_, OnSourceRemoved(list_.get(), 0)) |
| 122 .WillOnce(QuitMessageLoop()); | 116 .WillOnce(QuitMessageLoop()); |
| 123 | 117 |
| 124 list_->StartUpdating(&observer_); | 118 list_->StartUpdating(&observer_); |
| 125 base::RunLoop().Run(); | 119 base::RunLoop().Run(); |
| 126 window.reset(); | 120 window.reset(); |
| 127 base::RunLoop().Run(); | 121 base::RunLoop().Run(); |
| 128 } | 122 } |
| OLD | NEW |