| 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 #import "chrome/browser/ui/cocoa/media_picker/desktop_media_picker_controller.h" | 5 #import "chrome/browser/ui/cocoa/media_picker/desktop_media_picker_controller.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "chrome/browser/media/desktop_media_list_observer.h" | 10 #include "chrome/browser/media/desktop_media_list_observer.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 DesktopMediaPicker::DoneCallback callback = | 51 DesktopMediaPicker::DoneCallback callback = |
| 52 base::Bind(&DesktopMediaPickerControllerTest::OnResult, | 52 base::Bind(&DesktopMediaPickerControllerTest::OnResult, |
| 53 base::Unretained(this)); | 53 base::Unretained(this)); |
| 54 | 54 |
| 55 controller_.reset( | 55 controller_.reset( |
| 56 [[DesktopMediaPickerController alloc] | 56 [[DesktopMediaPickerController alloc] |
| 57 initWithMediaList:scoped_ptr<DesktopMediaList>(media_list_) | 57 initWithMediaList:scoped_ptr<DesktopMediaList>(media_list_) |
| 58 parent:nil | 58 parent:nil |
| 59 callback:callback | 59 callback:callback |
| 60 appName:ASCIIToUTF16("Screenshare Test")]); | 60 appName:base::ASCIIToUTF16("Screenshare Test")]); |
| 61 } | 61 } |
| 62 | 62 |
| 63 virtual void TearDown() OVERRIDE { | 63 virtual void TearDown() OVERRIDE { |
| 64 controller_.reset(); | 64 controller_.reset(); |
| 65 CocoaTest::TearDown(); | 65 CocoaTest::TearDown(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 bool WaitForCallback() { | 68 bool WaitForCallback() { |
| 69 if (!callback_called_) { | 69 if (!callback_called_) { |
| 70 base::RunLoop().RunUntilIdle(); | 70 base::RunLoop().RunUntilIdle(); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 media_list_->SetSourceThumbnail(0); | 179 media_list_->SetSourceThumbnail(0); |
| 180 EXPECT_NE(version, [[items objectAtIndex:0] imageVersion]); | 180 EXPECT_NE(version, [[items objectAtIndex:0] imageVersion]); |
| 181 } | 181 } |
| 182 | 182 |
| 183 TEST_F(DesktopMediaPickerControllerTest, RemoveSource) { | 183 TEST_F(DesktopMediaPickerControllerTest, RemoveSource) { |
| 184 [controller_ showWindow:nil]; | 184 [controller_ showWindow:nil]; |
| 185 | 185 |
| 186 media_list_->AddSource(0); | 186 media_list_->AddSource(0); |
| 187 media_list_->AddSource(1); | 187 media_list_->AddSource(1); |
| 188 media_list_->AddSource(2); | 188 media_list_->AddSource(2); |
| 189 media_list_->SetSourceName(1, ASCIIToUTF16("foo")); | 189 media_list_->SetSourceName(1, base::ASCIIToUTF16("foo")); |
| 190 | 190 |
| 191 NSArray* items = [controller_ items]; | 191 NSArray* items = [controller_ items]; |
| 192 EXPECT_EQ(3U, [items count]); | 192 EXPECT_EQ(3U, [items count]); |
| 193 EXPECT_NSEQ(@"foo", [[items objectAtIndex:1] imageTitle]); | 193 EXPECT_NSEQ(@"foo", [[items objectAtIndex:1] imageTitle]); |
| 194 } | 194 } |
| OLD | NEW |