Bug 1395566 - Enable more webrtc.org desktop capture tests; r=jesup
authorDan Minor <dminor@mozilla.com>
Fri, 01 Sep 2017 09:44:29 -0400
changeset 428798 bffbaa5f5924ee8d2a74eddf715c7421286f1466
parent 428797 d80fa4d123620fd099db9b0e790e5d5daed24590
child 428799 c8b7472de17bf8d1183883a309cda6fef41a93cd
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup
bugs1395566
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1395566 - Enable more webrtc.org desktop capture tests; r=jesup This adds the remaining desktop_capture unit tests with a few exceptions: app_capturer_unittest does not compile and is not built by webrtc.org, and desktop_capturer_differ_wrapper_unittest, rgba_color_unittest, screen_drawer_unittest and test_utils_unittest rely upon code that we do not build.
media/webrtc/trunk/gtest/moz.build
media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_and_cursor_composer_unittest.cc
media/webrtc/trunk/webrtc/modules/desktop_capture/fake_desktop_capturer.h
media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_unittest.cc
media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_packet_unittest.cc
--- a/media/webrtc/trunk/gtest/moz.build
+++ b/media/webrtc/trunk/gtest/moz.build
@@ -8,16 +8,17 @@
 # (see Bug 1336429) we can use the gn build files directly
 # rather than building things here.
 
 ALLOW_COMPILER_WARNINGS = True
 
 DEFINES['GTEST_RELATIVE_PATH'] = True
 DEFINES['WEBRTC_APM_DEBUG_DUMP'] = True
 DEFINES['WEBRTC_INTELLIGIBILITY_ENHANCER'] = 0
+DEFINES['WEBRTC_MOZILLA_BUILD'] = 1
 
 # Hit build errors on windows with xutility otherwise
 DISABLE_STL_WRAPPING = True
 
 LOCAL_INCLUDES += [
     '../',
     '/',
     '/ipc/chromium/src/',
@@ -105,16 +106,17 @@ if CONFIG['OS_TARGET'] in ['Darwin', 'Li
             '-framework Security',
             '-framework SystemConfiguration',
             '-framework IOKit',
             '-F%s' % CONFIG['MACOS_PRIVATE_FRAMEWORKS_DIR'],
             '-framework CoreUI',
         ]
 
         SOURCES += [
+             '../webrtc/modules/desktop_capture/screen_capturer_mac_unittest.cc',
              'OSXRunLoopSingleton.cpp',
         ]
     elif CONFIG['OS_TARGET'] == 'WINNT':
         DEFINES['WEBRTC_WIN'] = True
 
         DEFINES['UNICODE'] = True
         DEFINES['_UNICODE'] = True
 
@@ -308,27 +310,23 @@ if CONFIG['OS_TARGET'] in ['Darwin', 'Li
     # Requires external files
     #    '../webrtc/modules/audio_processing/vad/standalone_vad_unittest.cc',
         '../webrtc/modules/audio_processing/vad/vad_audio_proc_unittest.cc',
         '../webrtc/modules/audio_processing/vad/vad_circular_buffer_unittest.cc',
     # Requires external files
     #    '../webrtc/modules/audio_processing/vad/voice_activity_detector_unittest.cc',
         '../webrtc/modules/bitrate_controller/bitrate_controller_unittest.cc',
         '../webrtc/modules/bitrate_controller/send_side_bandwidth_estimation_unittest.cc',
+        '../webrtc/modules/desktop_capture/desktop_and_cursor_composer_unittest.cc',
+        '../webrtc/modules/desktop_capture/desktop_frame_rotation_unittest.cc',
         '../webrtc/modules/desktop_capture/desktop_region_unittest.cc',
         '../webrtc/modules/desktop_capture/differ_block_unittest.cc',
-    #    '../webrtc/modules/desktop_capture/differ_unittest.cc',
-    # Stack overflow
-    #    '../webrtc/modules/desktop_capture/mouse_cursor_monitor_unittest.cc',
-    # Stack overflow
-    #    '../webrtc/modules/desktop_capture/screen_capturer_helper_unittest.cc',
-    # Stack overflow
-    #    '../webrtc/modules/desktop_capture/screen_capturer_unittest.cc',
-    # Stack overflow
-    #    '../webrtc/modules/desktop_capture/window_capturer_unittest.cc',
+        '../webrtc/modules/desktop_capture/mouse_cursor_monitor_unittest.cc',
+        '../webrtc/modules/desktop_capture/screen_capturer_unittest.cc',
+        '../webrtc/modules/desktop_capture/test_utils.cc',
     # Requires external files
     #    '../webrtc/modules/media_file/media_file_unittest.cc',
         '../webrtc/modules/module_common_types_unittest.cc',
         '../webrtc/modules/pacing/bitrate_prober_unittest.cc',
         '../webrtc/modules/pacing/paced_sender_unittest.cc',
         '../webrtc/modules/pacing/packet_router_unittest.cc',
         '../webrtc/modules/remote_bitrate_estimator/aimd_rate_control_unittest.cc',
         '../webrtc/modules/remote_bitrate_estimator/inter_arrival_unittest.cc',
@@ -364,17 +362,16 @@ if CONFIG['OS_TARGET'] in ['Darwin', 'Li
         '../webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback_unittest.cc',
         '../webrtc/modules/rtp_rtcp/source/rtcp_packet/voip_metric_unittest.cc',
         '../webrtc/modules/rtp_rtcp/source/rtcp_utility_unittest.cc',
         '../webrtc/modules/rtp_rtcp/source/rtp_format_vp8_test_helper.cc',
         '../webrtc/modules/rtp_rtcp/source/rtp_format_vp8_unittest.cc',
         '../webrtc/modules/rtp_rtcp/source/rtp_format_vp9_unittest.cc',
         '../webrtc/modules/rtp_rtcp/source/rtp_header_extension_unittest.cc',
         '../webrtc/modules/rtp_rtcp/source/rtp_packet_history_unittest.cc',
-        '../webrtc/modules/rtp_rtcp/source/rtp_packet_unittest.cc',
         '../webrtc/modules/rtp_rtcp/source/rtp_payload_registry_unittest.cc',
         '../webrtc/modules/rtp_rtcp/source/time_util_unittest.cc',
         '../webrtc/modules/rtp_rtcp/source/ulpfec_generator_unittest.cc',
         '../webrtc/modules/rtp_rtcp/source/vp8_partition_aggregator_unittest.cc',
         '../webrtc/modules/utility/source/process_thread_impl_unittest.cc',
         '../webrtc/modules/video_capture/test/video_capture_unittest.cc',
         '../webrtc/modules/video_coding/codecs/test/packet_manipulator.cc',
         '../webrtc/modules/video_coding/codecs/test/predictive_packet_manipulator.cc',
@@ -507,16 +504,19 @@ if CONFIG['OS_TARGET'] in ['Darwin', 'Li
         '../webrtc/modules/congestion_controller/delay_based_bwe_unittest.cc',
         '../webrtc/modules/congestion_controller/delay_based_bwe_unittest_helper.cc',
         '../webrtc/modules/congestion_controller/median_slope_estimator_unittest.cc',
         '../webrtc/modules/congestion_controller/probe_bitrate_estimator_unittest.cc',
         '../webrtc/modules/congestion_controller/probe_controller_unittest.cc',
         '../webrtc/modules/congestion_controller/probing_interval_estimator_unittest.cc',
         '../webrtc/modules/congestion_controller/transport_feedback_adapter_unittest.cc',
         '../webrtc/modules/congestion_controller/trendline_estimator_unittest.cc',
+        '../webrtc/modules/desktop_capture/mock_desktop_capturer_callback.cc',
+        '../webrtc/modules/desktop_capture/screen_capturer_helper_unittest.cc',
+        '../webrtc/modules/desktop_capture/window_capturer_unittest.cc',
         '../webrtc/modules/remote_bitrate_estimator/test/bwe_unittest.cc',
         '../webrtc/modules/rtp_rtcp/source/flexfec_header_reader_writer_unittest.cc',
         '../webrtc/modules/rtp_rtcp/source/flexfec_sender_unittest.cc',
         '../webrtc/modules/rtp_rtcp/source/rtcp_packet/bye_unittest.cc',
         '../webrtc/modules/rtp_rtcp/source/rtcp_packet/common_header_unittest.cc',
         '../webrtc/modules/rtp_rtcp/source/rtcp_packet/compound_packet_unittest.cc',
         '../webrtc/modules/rtp_rtcp/source/rtcp_packet/dlrr_unittest.cc',
         '../webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_reports_unittest.cc',
@@ -537,16 +537,17 @@ if CONFIG['OS_TARGET'] in ['Darwin', 'Li
         '../webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr_unittest.cc',
         '../webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback_unittest.cc',
         '../webrtc/modules/rtp_rtcp/source/rtcp_packet_unittest.cc',
     # Test failures
     #   '../webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc',
         '../webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc',
         '../webrtc/modules/rtp_rtcp/source/rtp_fec_unittest.cc',
         '../webrtc/modules/rtp_rtcp/source/rtp_format_h264_unittest.cc',
+        '../webrtc/modules/rtp_rtcp/source/rtp_packet_unittest.cc',
         '../webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc',
     # Test failures
     #    '../webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc',
         '../webrtc/modules/rtp_rtcp/source/rtp_utility_unittest.cc',
         '../webrtc/modules/rtp_rtcp/source/ulpfec_header_reader_writer_unittest.cc',
         '../webrtc/modules/rtp_rtcp/source/ulpfec_receiver_unittest.cc',
         '../webrtc/modules/video_coding/codecs/test/packet_manipulator_unittest.cc',
         '../webrtc/modules/video_coding/codecs/test/stats_unittest.cc',
--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_and_cursor_composer_unittest.cc
+++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_and_cursor_composer_unittest.cc
@@ -70,16 +70,17 @@ DesktopFrame* CreateTestFrame() {
   return frame;
 }
 
 class FakeScreenCapturer : public DesktopCapturer {
  public:
   FakeScreenCapturer() {}
 
   void Start(Callback* callback) override { callback_ = callback; }
+  void Stop() override {};
 
   void CaptureFrame() override {
     callback_->OnCaptureResult(
         next_frame_ ? Result::SUCCESS : Result::ERROR_TEMPORARY,
         std::move(next_frame_));
   }
 
   void SetNextFrame(std::unique_ptr<DesktopFrame> next_frame) {
@@ -102,17 +103,18 @@ class FakeMouseMonitor : public MouseCur
   }
 
   void SetHotspot(const DesktopVector& hotspot) {
     if (!hotspot_.equals(hotspot))
       changed_ = true;
     hotspot_ = hotspot;
   }
 
-  void Init(Callback* callback, Mode mode) override { callback_ = callback; }
+  void Start(Callback* callback, Mode mode) { callback_ = callback; }
+  void Stop() override {};
 
   void Capture() override {
     if (changed_) {
       std::unique_ptr<DesktopFrame> image(
           new BasicDesktopFrame(DesktopSize(kCursorWidth, kCursorHeight)));
       uint32_t* data = reinterpret_cast<uint32_t*>(image->data());
       memset(data, 0, image->stride() * kCursorHeight);
 
--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/fake_desktop_capturer.h
+++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/fake_desktop_capturer.h
@@ -40,16 +40,17 @@ class FakeDesktopCapturer : public Deskt
   void set_result(DesktopCapturer::Result result);
 
   // Uses the |generator| provided as DesktopFrameGenerator, FakeDesktopCapturer
   // does not take the ownership of |generator|.
   void set_frame_generator(DesktopFrameGenerator* generator);
 
   // DesktopCapturer interface
   void Start(DesktopCapturer::Callback* callback) override;
+  void Stop() override {};
   void CaptureFrame() override;
   void SetSharedMemoryFactory(
       std::unique_ptr<SharedMemoryFactory> shared_memory_factory) override;
   bool GetSourceList(DesktopCapturer::SourceList* sources) override;
   bool SelectSource(DesktopCapturer::SourceId id) override;
 
  private:
   static constexpr DesktopCapturer::SourceId kWindowId = 1378277495;
--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_unittest.cc
+++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_unittest.cc
@@ -44,23 +44,28 @@ class ScreenCapturerTest : public testin
   // should be used.
   void MaybeCreateDirectxCapturer() {
     DesktopCaptureOptions options(DesktopCaptureOptions::CreateDefault());
     options.set_allow_directx_capturer(true);
     capturer_ = DesktopCapturer::CreateScreenCapturer(options);
   }
 
   bool CreateDirectxCapturer() {
+    // Mozilla builds do not include the DirectX Capturer
+    #if !defined(WEBRTC_MOZILLA_BUILD)
     if (!ScreenCapturerWinDirectx::IsSupported()) {
       LOG(LS_WARNING) << "Directx capturer is not supported";
       return false;
     }
 
     MaybeCreateDirectxCapturer();
     return true;
+    #else
+    return false;
+    #endif
   }
 
   void CreateMagnifierCapturer() {
     DesktopCaptureOptions options(DesktopCaptureOptions::CreateDefault());
     options.set_allow_use_magnification_api(true);
     capturer_ = DesktopCapturer::CreateScreenCapturer(options);
   }
 #endif  // defined(WEBRTC_WIN)
--- a/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_packet_unittest.cc
+++ b/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_packet_unittest.cc
@@ -492,15 +492,15 @@ TEST(RtpPacketTest, RawExtensionFunction
   // Use ExtensionManager to set kInvalidId to 0 to demonstrate natural way for
   // using zero value as a parameter to Packet::*RawExtension functions.
   const int kInvalidId = extensions.GetId(TransmissionOffset::kId);
   ASSERT_EQ(kInvalidId, 0);
 
   ASSERT_TRUE(packet.Parse(kPacket, sizeof(kPacket)));
 
   EXPECT_FALSE(packet.HasRawExtension(kInvalidId));
-  EXPECT_THAT(packet.GetRawExtension(kInvalidId), IsEmpty());
+  EXPECT_THAT(packet.GetRawExtension(kInvalidId), testing::IsEmpty());
   const uint8_t kExtension[] = {'e', 'x', 't'};
   EXPECT_FALSE(packet.SetRawExtension(kInvalidId, kExtension));
-  EXPECT_THAT(packet.AllocateRawExtension(kInvalidId, 3), IsEmpty());
+  EXPECT_THAT(packet.AllocateRawExtension(kInvalidId, 3), testing::IsEmpty());
 }
 
 }  // namespace webrtc