Skip to content

Commit

Permalink
Reland: Extract media/capture/capture_unittests from media_unittests
Browse files Browse the repository at this point in the history
Original CL got reverted due to audio_unittests not finding two
symbols
error LNK2019: unresolved external symbol CLSID_DxDiagProvider
error LNK2019: unresolved external symbol IID_IDxDiagProvider

CQ doesn't have any gyp + win x64 bot, so didn't catch
it, but it can be repro using   win_clang_x64_rel bot --  see
it failing in PS1 and compiling in PS2.

Original's issue description -------------------------------------------
Extract media/capture/capture_unittests from media_unittests

This CL:
- extracts capture_unittests out of media_unittests.
- adds it to all testing/buildbot/*.json where appropriate,
  i.e. where there is media_unittests.
- adds the necessary .isolate and _apk.isolate.

BUG=618718
TEST= No new code added, all bots running capture_unittests
and being happy with it.¯

------------------------------------------------------------------------

TBR=miu@chromium.org, xhwang@chromium.org, maruel@chromium.org, brettw@chromium.org

Review-Url: https://codereview.chromium.org/2095623003
Cr-Commit-Position: refs/heads/master@{#401927}
  • Loading branch information
yellowdoge authored and Commit bot committed Jun 24, 2016
1 parent 3e3545a commit d2f53ea
Show file tree
Hide file tree
Showing 24 changed files with 649 additions and 26 deletions.
1 change: 1 addition & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ group("both_gn_and_gyp") {
"//gpu/ipc/service:gpu_ipc_service_unittests",
"//ipc:ipc_tests",
"//media:media_unittests",
"//media/capture:capture_unittests",
"//media/cast:cast_unittests",
"//media/midi:midi_unittests",
"//mojo",
Expand Down
11 changes: 11 additions & 0 deletions build/all.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
'../gpu/tools/tools.gyp:*',
'../ipc/ipc.gyp:*',
'../jingle/jingle.gyp:*',
'../media/capture/capture.gyp:*',
'../media/cast/cast.gyp:*',
'../media/media.gyp:*',
'../media/midi/midi.gyp:*',
Expand Down Expand Up @@ -341,6 +342,7 @@
'../gpu/gpu.gyp:gpu_unittests',
'../ipc/ipc.gyp:ipc_tests',
'../jingle/jingle.gyp:jingle_unittests',
'../media/capture/capture.gyp:capture_unittests',
'../media/cast/cast.gyp:cast_unittests',
'../media/media.gyp:media_unittests',
'../media/midi/midi.gyp:midi_unittests',
Expand Down Expand Up @@ -596,6 +598,7 @@
'../chrome/chrome.gyp:browser_tests',
'../content/content_shell_and_tests.gyp:content_browsertests',
'../content/content_shell_and_tests.gyp:content_unittests',
'../media/capture/capture.gyp:capture_unittests',
'../media/media.gyp:media_unittests',
'../media/midi/midi.gyp:midi_unittests',
'../third_party/webrtc/tools/tools.gyp:frame_analyzer',
Expand Down Expand Up @@ -728,6 +731,7 @@
'../gpu/gpu.gyp:gpu_perftests_apk',
'../gpu/gpu.gyp:gpu_unittests',
'../ipc/ipc.gyp:ipc_tests',
'../media/capture/capture.gyp:capture_unittests',
'../media/media.gyp:media_perftests_apk',
'../media/media.gyp:media_unittests',
'../media/midi/midi.gyp:midi_unittests_apk',
Expand Down Expand Up @@ -843,6 +847,7 @@
'../gpu/gpu.gyp:gpu_unittests',
'../ipc/ipc.gyp:ipc_tests',
'../jingle/jingle.gyp:jingle_unittests',
'../media/capture/capture.gyp:capture_unittests',
'../media/media.gyp:media_unittests',
'../media/midi/midi.gyp:midi_unittests',
'../ppapi/ppapi_internal.gyp:ppapi_unittests',
Expand Down Expand Up @@ -882,6 +887,7 @@
'../gpu/gpu.gyp:gpu_unittests',
'../ipc/ipc.gyp:ipc_tests',
'../jingle/jingle.gyp:jingle_unittests',
'../media/capture/capture.gyp:capture_unittests',
'../media/media.gyp:media_unittests',
'../media/midi/midi.gyp:midi_unittests',
'../ppapi/ppapi_internal.gyp:ppapi_unittests',
Expand Down Expand Up @@ -910,6 +916,7 @@
'../crypto/crypto.gyp:crypto_unittests',
'../ipc/ipc.gyp:ipc_tests',
'../jingle/jingle.gyp:jingle_unittests',
'../media/capture/capture.gyp:capture_unittests',
'../media/media.gyp:media_unittests',
'../media/midi/midi.gyp:midi_unittests',
'../net/net.gyp:net_unittests',
Expand Down Expand Up @@ -952,6 +959,7 @@
'../gpu/gpu.gyp:gpu_unittests',
'../ipc/ipc.gyp:ipc_tests',
'../jingle/jingle.gyp:jingle_unittests',
'../media/capture/capture.gyp:capture_unittests',
'../media/media.gyp:media_unittests',
'../media/midi/midi.gyp:midi_unittests',
'../ppapi/ppapi_internal.gyp:ppapi_unittests',
Expand Down Expand Up @@ -985,6 +993,7 @@
'../crypto/crypto.gyp:crypto_unittests',
'../ipc/ipc.gyp:ipc_tests',
'../jingle/jingle.gyp:jingle_unittests',
'../media/capture/capture.gyp:capture_unittests',
'../media/media.gyp:media_unittests',
'../media/midi/midi.gyp:midi_unittests',
'../net/net.gyp:net_unittests',
Expand Down Expand Up @@ -1040,6 +1049,7 @@
'../gpu/gpu.gyp:gpu_unittests',
'../ipc/ipc.gyp:ipc_tests',
'../jingle/jingle.gyp:jingle_unittests',
'../media/capture/capture.gyp:capture_unittests',
'../media/cast/cast.gyp:cast_unittests',
'../media/media.gyp:media_unittests',
'../media/midi/midi.gyp:midi_unittests',
Expand Down Expand Up @@ -1100,6 +1110,7 @@
'../chrome/chrome.gyp:browser_tests',
'../chrome/chrome.gyp:sync_integration_tests',
'../ipc/ipc.gyp:ipc_tests',
'../media/capture/capture.gyp:capture_unittests',
'../media/media.gyp:media_unittests',
'../media/midi/midi.gyp:midi_unittests',
'../net/net.gyp:net_unittests',
Expand Down
4 changes: 0 additions & 4 deletions media/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -597,9 +597,6 @@ test("media_unittests") {
"//media/audio:unittests",
"//media/base:test_support",
"//media/base:unittests",

# TODO(mcasas): Remove the capture sources after https://crbug.com/618718.
"//media/capture:unittests",
"//media/test:pipeline_integration_tests",
"//skia", # Direct dependency required to inherit config.
"//testing/gmock",
Expand All @@ -621,7 +618,6 @@ test("media_unittests") {
deps += [
"//media/base/android:media_java",
"//media/base/android:unittests",
"//media/capture/video/android:capture_java",
"//ui/android:ui_java",
]
}
Expand Down
2 changes: 0 additions & 2 deletions media/base/run_all_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include "base/android/jni_android.h"
#include "media/base/android/media_codec_util.h"
#include "media/base/android/media_jni_registrar.h"
#include "media/capture/video/android/capture_jni_registrar.h"
#include "ui/gl/android/gl_jni_registrar.h"
#endif

Expand Down Expand Up @@ -45,7 +44,6 @@ void TestSuiteNoAtExit::Initialize() {
// Needed for surface texture support.
ui::gl::android::RegisterJni(env);
media::RegisterJni(env);
media::RegisterCaptureJni(env);

if (media::MediaCodecUtil::IsMediaCodecAvailable())
media::EnablePlatformDecoderSupport();
Expand Down
13 changes: 9 additions & 4 deletions media/capture/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,7 @@ component("capture") {
}
}

# TODO(mcasas): Make this a test target, https://crbug.com/618718.
source_set("unittests") {
testonly = true

test("capture_unittests") {
sources = [
"content/animated_content_sampler_unittest.cc",
"content/capture_resolution_chooser_unittest.cc",
Expand All @@ -161,10 +158,18 @@ source_set("unittests") {

deps = [
":capture",
"//base/test:run_all_unittests",
"//base/test:test_support",
"//media/base:test_support",
"//testing/gmock",
"//testing/gtest",
"//ui/gfx:test_support",
]

if (is_android) {
deps += [ "//media/capture/video/android:capture_java" ]
}

if (is_win) {
# TODO(jschuh): https://crbug.com/167187 fix size_t to int truncations.
configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
Expand Down
95 changes: 87 additions & 8 deletions media/capture/capture.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
['OS=="android"', {
'dependencies': [
'capture_java',
'<(DEPTH)/media/capture/video/android'
],
}],
['OS=="mac"', {
Expand Down Expand Up @@ -157,21 +158,64 @@
},

{
# GN version: //media/capture:unittests source_set
'target_name': 'unittests',
'type': 'none',
# GN version: //media/capture:capture_unittests
'target_name': 'capture_unittests',
'type': '<(gtest_target_type)',
'include_dirs': [
'<(DEPTH)/',
],
'dependencies': [
'capture',
'<(DEPTH)/base/base.gyp:base',
'<(DEPTH)/base/base.gyp:run_all_unittests',
'<(DEPTH)/media/media.gyp:media',
'<(DEPTH)/testing/gmock.gyp:gmock',
'<(DEPTH)/testing/gtest.gyp:gtest',
'<(DEPTH)/ui/gfx/gfx.gyp:gfx',
'<(DEPTH)/ui/gfx/gfx.gyp:gfx_geometry',
'<(DEPTH)/ui/gfx/gfx.gyp:gfx_test_support',
],
'direct_dependent_settings': {
'sources': [
'<@(capture_unittests_sources)'
],
},
'sources': [
'<@(capture_unittests_sources)'
],
'conditions': [
['OS=="android"', {
'dependencies': [
'<(DEPTH)/testing/android/native_test.gyp:native_test_native_code',
],
}],
['OS=="win"', {
'dependencies': [
'<(DEPTH)/media/media.gyp:mf_initializer',
],
# TODO(jschuh): http://crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [ 4267, ],
}],
], # conditions
},
],

'conditions': [

['test_isolation_mode != "noop"', {
'targets': [
{
# There's no GN equivalent to this.
'target_name': 'capture_unittests_run',
'type': 'none',
'dependencies': [
'capture_unittests',
],
'includes': [
'../../build/isolate.gypi',
],
'sources': [
'capture_unittests.isolate',
]
}
]
}],

['OS=="android"', {
'targets': [
{
Expand Down Expand Up @@ -219,7 +263,42 @@
},
'includes': ['../../build/jni_generator.gypi'],
},

{
# There's no GN equivalent to this.
'target_name': 'capture_unittests_apk',
'type': 'none',
'dependencies': [
'capture_java',
'capture_unittests',
],
'variables': {
'test_suite_name': 'capture_unittests',
},
'includes': ['../../build/apk_test.gypi'],
},
],
'conditions': [
['test_isolation_mode != "noop"', {
'targets': [
{
'target_name': 'capture_unittests_apk_run',
'type': 'none',
'dependencies': [
'capture_unittests_apk',
],
'includes': [
'../../build/isolate.gypi',
],
'sources': [
'capture_unittests_apk.isolate',
],
},
],
}],
],

}],

],
}
62 changes: 62 additions & 0 deletions media/capture/capture_unittests.isolate
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'includes': [
'../../base/base.isolate',
],
'conditions': [
['use_x11==0', {
'variables': {
'command': [
'../../testing/test_env.py',
'<(PRODUCT_DIR)/capture_unittests<(EXECUTABLE_SUFFIX)',
'--brave-new-test-launcher',
'--test-launcher-bot-mode',
'--asan=<(asan)',
'--msan=<(msan)',
'--tsan=<(tsan)',
],
},
}],
['use_x11==1', {
'variables': {
'command': [
'../../testing/xvfb.py',
'<(PRODUCT_DIR)',
'<(PRODUCT_DIR)/capture_unittests',
'--brave-new-test-launcher',
'--test-launcher-bot-mode',
'--asan=<(asan)',
'--msan=<(msan)',
'--tsan=<(tsan)',
],
'files': [
'../../testing/xvfb.py',
'<(PRODUCT_DIR)/xdisplaycheck',
],
},
}],
['OS=="linux" or OS=="mac" or OS=="win"', {
'variables': {
'files': [
'../../testing/test_env.py',
],
},
}],
['OS=="mac" and asan==1 and fastbuild==0', {
'variables': {
'files': [
'<(PRODUCT_DIR)/capture_unittests.dSYM/',
],
},
}],
['OS=="win" and (fastbuild==0 or fastbuild==1)', {
'variables': {
'files': [
'<(PRODUCT_DIR)/capture_unittests.exe.pdb',
],
},
}],
],
}
18 changes: 18 additions & 0 deletions media/capture/capture_unittests_apk.isolate
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'includes': [
'../../build/android/android.isolate',
],
'variables': {
'command': [
'<(PRODUCT_DIR)/bin/run_capture_unittests',
'--logcat-output-dir', '${ISOLATED_OUTDIR}/logcats',
],
'files': [
'<(PRODUCT_DIR)/bin/run_capture_unittests',
'<(PRODUCT_DIR)/capture_unittests_apk/',
]
},
}
3 changes: 1 addition & 2 deletions media/capture/video/android/photo_capabilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
#include <string>

#include "base/android/scoped_java_ref.h"
#include "media/base/media_export.h"

namespace media {

class MEDIA_EXPORT PhotoCapabilities {
class PhotoCapabilities {
public:
explicit PhotoCapabilities(base::android::ScopedJavaLocalRef<jobject> object);
~PhotoCapabilities();
Expand Down
Loading

0 comments on commit d2f53ea

Please sign in to comment.