Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Side by Side Diff: chrome/browser/media/native_desktop_media_list_unittest.cc

Issue 1895743007: Disable aura window capture unit tests in unix (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/valgrind/gtest_exclude/unit_tests.gtest_linux.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/native_desktop_media_list.h" 5 #include "chrome/browser/media/native_desktop_media_list.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <string.h> 9 #include <string.h>
10 #include <vector> 10 #include <vector>
(...skipping 16 matching lines...) Expand all
27 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" 27 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
28 #include "ui/views/widget/widget.h" 28 #include "ui/views/widget/widget.h"
29 29
30 using content::DesktopMediaID; 30 using content::DesktopMediaID;
31 using testing::_; 31 using testing::_;
32 using testing::DoAll; 32 using testing::DoAll;
33 33
34 namespace { 34 namespace {
35 35
36 static const int kDefaultWindowCount = 2; 36 static const int kDefaultWindowCount = 2;
37 #if defined(USE_AURA) 37 #if defined(OS_WIN)
Sergey Ulanov 2016/04/20 20:58:14 it should be clear from the code why Aura tests ar
GeorgeZ 2016/04/20 21:38:33 Good point.
38 static const int kDefaultAuraCount = 1; 38 static const int kDefaultAuraCount = 1;
39 #else 39 #else
40 static const int kDefaultAuraCount = 0; 40 static const int kDefaultAuraCount = 0;
41 #endif 41 #endif
42 42
43 class MockObserver : public DesktopMediaListObserver { 43 class MockObserver : public DesktopMediaListObserver {
44 public: 44 public:
45 MOCK_METHOD2(OnSourceAdded, void(DesktopMediaList* list, int index)); 45 MOCK_METHOD2(OnSourceAdded, void(DesktopMediaList* list, int index));
46 MOCK_METHOD2(OnSourceRemoved, void(DesktopMediaList* list, int index)); 46 MOCK_METHOD2(OnSourceRemoved, void(DesktopMediaList* list, int index));
47 MOCK_METHOD3(OnSourceMoved, 47 MOCK_METHOD3(OnSourceMoved,
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 if (window) 179 if (window)
180 window_capturer_ = new FakeWindowCapturer(); 180 window_capturer_ = new FakeWindowCapturer();
181 else 181 else
182 window_capturer_ = nullptr; 182 window_capturer_ = nullptr;
183 183
184 model_.reset(new NativeDesktopMediaList( 184 model_.reset(new NativeDesktopMediaList(
185 std::unique_ptr<webrtc::ScreenCapturer>(screen_capturer), 185 std::unique_ptr<webrtc::ScreenCapturer>(screen_capturer),
186 std::unique_ptr<webrtc::WindowCapturer>(window_capturer_))); 186 std::unique_ptr<webrtc::WindowCapturer>(window_capturer_)));
187 187
188 // Set update period to reduce the time it takes to run tests. 188 // Set update period to reduce the time it takes to run tests.
189 model_->SetUpdatePeriod(base::TimeDelta::FromMilliseconds(5)); 189 model_->SetUpdatePeriod(base::TimeDelta::FromMilliseconds(20));
Sergey Ulanov 2016/04/20 20:58:14 Why change this period?
GeorgeZ 2016/04/20 21:38:33 Pleas see Comment 3 in https://bugs.chromium.org/p
190 } 190 }
191 191
192 void AddNativeWindow(int id) { 192 void AddNativeWindow(int id) {
193 webrtc::WindowCapturer::Window window; 193 webrtc::WindowCapturer::Window window;
194 window.id = id; 194 window.id = id;
195 window.title = "Test window"; 195 window.title = "Test window";
196 window_list_.push_back(window); 196 window_list_.push_back(window);
197 } 197 }
198 198
199 #if defined(USE_AURA) 199 #if defined(USE_AURA)
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 webrtc::WindowCapturer::Window window; 381 webrtc::WindowCapturer::Window window;
382 AddNativeWindow(index); 382 AddNativeWindow(index);
383 window_capturer_->SetWindowList(window_list_); 383 window_capturer_->SetWindowList(window_list_);
384 384
385 message_loop()->Run(); 385 message_loop()->Run();
386 386
387 EXPECT_EQ(model_->GetSource(index).id.type, DesktopMediaID::TYPE_WINDOW); 387 EXPECT_EQ(model_->GetSource(index).id.type, DesktopMediaID::TYPE_WINDOW);
388 EXPECT_EQ(model_->GetSource(index).id.id, index); 388 EXPECT_EQ(model_->GetSource(index).id.id, index);
389 } 389 }
390 390
391 #if defined(USE_AURA) 391 #if defined(OS_WIN)
392 TEST_F(NativeDesktopMediaListTest, AddAuraWindow) { 392 TEST_F(NativeDesktopMediaListTest, AddAuraWindow) {
393 AddWindowsAndVerify(true, kDefaultWindowCount, kDefaultAuraCount, false); 393 AddWindowsAndVerify(true, kDefaultWindowCount, kDefaultAuraCount, false);
394 394
395 const int index = kDefaultWindowCount + 1; 395 const int index = kDefaultWindowCount + 1;
396 EXPECT_CALL(observer_, OnSourceAdded(model_.get(), index)) 396 EXPECT_CALL(observer_, OnSourceAdded(model_.get(), index))
397 .WillOnce(DoAll(CheckListSize(model_.get(), index + 1), 397 .WillOnce(DoAll(CheckListSize(model_.get(), index + 1),
398 QuitMessageLoop(message_loop()))); 398 QuitMessageLoop(message_loop())));
399 399
400 AddAuraWindow(); 400 AddAuraWindow();
401 window_capturer_->SetWindowList(window_list_); 401 window_capturer_->SetWindowList(window_list_);
402 402
403 message_loop()->Run(); 403 message_loop()->Run();
404 404
405 int native_id = window_list_.back().id; 405 int native_id = window_list_.back().id;
406 EXPECT_EQ(model_->GetSource(index).id.type, DesktopMediaID::TYPE_WINDOW); 406 EXPECT_EQ(model_->GetSource(index).id.type, DesktopMediaID::TYPE_WINDOW);
407 EXPECT_EQ(model_->GetSource(index).id.id, native_id); 407 EXPECT_EQ(model_->GetSource(index).id.id, native_id);
408 EXPECT_EQ(model_->GetSource(index).id.aura_id, 408 EXPECT_EQ(model_->GetSource(index).id.aura_id,
409 native_aura_id_map_[native_id]); 409 native_aura_id_map_[native_id]);
410 } 410 }
411 #endif // defined(USE_AURA) 411 #endif // defined(OS_WIN)
412 412
413 TEST_F(NativeDesktopMediaListTest, RemoveNativeWindow) { 413 TEST_F(NativeDesktopMediaListTest, RemoveNativeWindow) {
414 AddWindowsAndVerify(true, kDefaultWindowCount, kDefaultAuraCount, false); 414 AddWindowsAndVerify(true, kDefaultWindowCount, kDefaultAuraCount, false);
415 415
416 EXPECT_CALL(observer_, OnSourceRemoved(model_.get(), 1)) 416 EXPECT_CALL(observer_, OnSourceRemoved(model_.get(), 1))
417 .WillOnce(DoAll(CheckListSize(model_.get(), kDefaultWindowCount), 417 .WillOnce(DoAll(CheckListSize(model_.get(), kDefaultWindowCount),
418 QuitMessageLoop(message_loop()))); 418 QuitMessageLoop(message_loop())));
419 419
420 window_list_.erase(window_list_.begin()); 420 window_list_.erase(window_list_.begin());
421 window_capturer_->SetWindowList(window_list_); 421 window_capturer_->SetWindowList(window_list_);
422 422
423 message_loop()->Run(); 423 message_loop()->Run();
424 } 424 }
425 425
426 #if defined(USE_AURA) 426 #if defined(OS_WIN)
427 TEST_F(NativeDesktopMediaListTest, RemoveAuraWindow) { 427 TEST_F(NativeDesktopMediaListTest, RemoveAuraWindow) {
428 AddWindowsAndVerify(true, kDefaultWindowCount, kDefaultAuraCount, false); 428 AddWindowsAndVerify(true, kDefaultWindowCount, kDefaultAuraCount, false);
429 429
430 int aura_window_start_index = kDefaultWindowCount - kDefaultAuraCount + 1; 430 int aura_window_start_index = kDefaultWindowCount - kDefaultAuraCount + 1;
431 EXPECT_CALL(observer_, OnSourceRemoved(model_.get(), aura_window_start_index)) 431 EXPECT_CALL(observer_, OnSourceRemoved(model_.get(), aura_window_start_index))
432 .WillOnce(DoAll(CheckListSize(model_.get(), kDefaultWindowCount), 432 .WillOnce(DoAll(CheckListSize(model_.get(), kDefaultWindowCount),
433 QuitMessageLoop(message_loop()))); 433 QuitMessageLoop(message_loop())));
434 434
435 RemoveAuraWindow(0); 435 RemoveAuraWindow(0);
436 window_capturer_->SetWindowList(window_list_); 436 window_capturer_->SetWindowList(window_list_);
437 437
438 message_loop()->Run(); 438 message_loop()->Run();
439 } 439 }
440 #endif // defined(USE_AURA) 440 #endif // defined(OS_WIN)
441 441
442 TEST_F(NativeDesktopMediaListTest, RemoveAllWindows) { 442 TEST_F(NativeDesktopMediaListTest, RemoveAllWindows) {
443 AddWindowsAndVerify(true, kDefaultWindowCount, kDefaultAuraCount, false); 443 AddWindowsAndVerify(true, kDefaultWindowCount, kDefaultAuraCount, false);
444 444
445 testing::InSequence seq; 445 testing::InSequence seq;
446 for (int i = 0; i < kDefaultWindowCount - 1; i++) { 446 for (int i = 0; i < kDefaultWindowCount - 1; i++) {
447 EXPECT_CALL(observer_, OnSourceRemoved(model_.get(), 1)) 447 EXPECT_CALL(observer_, OnSourceRemoved(model_.get(), 1))
448 .WillOnce(CheckListSize(model_.get(), kDefaultWindowCount - i)); 448 .WillOnce(CheckListSize(model_.get(), kDefaultWindowCount - i));
449 } 449 }
450 EXPECT_CALL(observer_, OnSourceRemoved(model_.get(), 1)) 450 EXPECT_CALL(observer_, OnSourceRemoved(model_.get(), 1))
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 QuitMessageLoop(message_loop()))); 492 QuitMessageLoop(message_loop())));
493 493
494 // Swap the two windows. 494 // Swap the two windows.
495 webrtc::WindowCapturer::Window temp = window_list_[0]; 495 webrtc::WindowCapturer::Window temp = window_list_[0];
496 window_list_[0] = window_list_[1]; 496 window_list_[0] = window_list_[1];
497 window_list_[1] = temp; 497 window_list_[1] = temp;
498 window_capturer_->SetWindowList(window_list_); 498 window_capturer_->SetWindowList(window_list_);
499 499
500 message_loop()->Run(); 500 message_loop()->Run();
501 } 501 }
OLDNEW
« no previous file with comments | « no previous file | tools/valgrind/gtest_exclude/unit_tests.gtest_linux.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698