| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 TEST_F(DesktopMediaListAshTest, Screen) { | 60 TEST_F(DesktopMediaListAshTest, Screen) { |
| 61 CreateList(DesktopMediaListAsh::SCREENS | DesktopMediaListAsh::WINDOWS); | 61 CreateList(DesktopMediaListAsh::SCREENS | DesktopMediaListAsh::WINDOWS); |
| 62 | 62 |
| 63 EXPECT_CALL(observer_, OnSourceAdded(list_.get(), 0)); | 63 EXPECT_CALL(observer_, OnSourceAdded(list_.get(), 0)); |
| 64 EXPECT_CALL(observer_, OnSourceThumbnailChanged(list_.get(), 0)) | 64 EXPECT_CALL(observer_, OnSourceThumbnailChanged(list_.get(), 0)) |
| 65 .WillOnce(QuitMessageLoop()) | 65 .WillOnce(QuitMessageLoop()) |
| 66 .WillRepeatedly(DoDefault()); | 66 .WillRepeatedly(DoDefault()); |
| 67 list_->StartUpdating(&observer_); | 67 list_->StartUpdating(&observer_); |
| 68 base::RunLoop().Run(); | 68 base::RunLoop().Run(); |
| 69 | |
| 70 // Reset the unique_ptr so the list stops refreshing. | |
| 71 list_.reset(); | |
| 72 } | 69 } |
| 73 | 70 |
| 74 TEST_F(DesktopMediaListAshTest, OneWindow) { | 71 TEST_F(DesktopMediaListAshTest, OneWindow) { |
| 75 CreateList(DesktopMediaListAsh::SCREENS | DesktopMediaListAsh::WINDOWS); | 72 CreateList(DesktopMediaListAsh::SCREENS | DesktopMediaListAsh::WINDOWS); |
| 76 | 73 |
| 77 std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithId(0)); | 74 std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithId(0)); |
| 78 | 75 |
| 79 EXPECT_CALL(observer_, OnSourceAdded(list_.get(), 0)); | 76 EXPECT_CALL(observer_, OnSourceAdded(list_.get(), 0)); |
| 80 EXPECT_CALL(observer_, OnSourceAdded(list_.get(), 1)); | 77 EXPECT_CALL(observer_, OnSourceAdded(list_.get(), 1)); |
| 81 EXPECT_CALL(observer_, OnSourceThumbnailChanged(list_.get(), 0)) | 78 EXPECT_CALL(observer_, OnSourceThumbnailChanged(list_.get(), 0)) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 .WillOnce(QuitMessageLoop()) | 113 .WillOnce(QuitMessageLoop()) |
| 117 .WillRepeatedly(DoDefault()); | 114 .WillRepeatedly(DoDefault()); |
| 118 EXPECT_CALL(observer_, OnSourceRemoved(list_.get(), 0)) | 115 EXPECT_CALL(observer_, OnSourceRemoved(list_.get(), 0)) |
| 119 .WillOnce(QuitMessageLoop()); | 116 .WillOnce(QuitMessageLoop()); |
| 120 | 117 |
| 121 list_->StartUpdating(&observer_); | 118 list_->StartUpdating(&observer_); |
| 122 base::RunLoop().Run(); | 119 base::RunLoop().Run(); |
| 123 window.reset(); | 120 window.reset(); |
| 124 base::RunLoop().Run(); | 121 base::RunLoop().Run(); |
| 125 } | 122 } |
| OLD | NEW |