Skip to content

Commit

Permalink
Disable NPLB test cases that are not applicable to Android
Browse files Browse the repository at this point in the history
b/338229737
b/368228941
b/379602017
b/380030274
b/380031306
b/380032222
b/380344836
b/380347735
  • Loading branch information
jonastsai committed Jan 22, 2025
1 parent 41f30d8 commit b4ad82a
Show file tree
Hide file tree
Showing 13 changed files with 142 additions and 0 deletions.
6 changes: 6 additions & 0 deletions starboard/nplb/directory_can_open_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "starboard/configuration_constants.h"
#include "starboard/directory.h"
#include "starboard/nplb/file_helpers.h"
#include "starboard/nplb/testcase_helpers.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace starboard {
Expand All @@ -34,6 +35,11 @@ TEST(SbDirectoryCanOpenTest, SunnyDay) {
}

TEST(SbDirectoryCanOpenTest, SunnyDayStaticContent) {
// TODO(b/380344836): Skip test case(s) not applicable to Android.
if (GetRuntimePlatform() == PlatformType::kPlatformTypeAndroid) {
GTEST_SKIP() << "Not applicable on Android";
}

for (auto dir_path : GetFileTestsDirectoryPaths()) {
EXPECT_TRUE(SbDirectoryCanOpen(dir_path.c_str()))
<< "Can't open: " << dir_path;
Expand Down
6 changes: 6 additions & 0 deletions starboard/nplb/directory_get_next_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "starboard/directory.h"
#include "starboard/file.h"
#include "starboard/nplb/file_helpers.h"
#include "starboard/nplb/testcase_helpers.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace starboard {
Expand Down Expand Up @@ -90,6 +91,11 @@ TEST(SbDirectoryGetNextTest, SunnyDay) {
}

TEST(SbDirectoryGetNextTest, SunnyDayStaticContent) {
// TODO(b/380344836): Skip test case(s) not applicable to Android.
if (GetRuntimePlatform() == PlatformType::kPlatformTypeAndroid) {
GTEST_SKIP() << "Not applicable on Android";
}

std::string testdata_dir = GetFileTestsDataDir();
EXPECT_FALSE(testdata_dir.empty());
EXPECT_TRUE(FileExists(testdata_dir.c_str()))
Expand Down
6 changes: 6 additions & 0 deletions starboard/nplb/directory_open_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "starboard/directory.h"
#include "starboard/file.h"
#include "starboard/nplb/file_helpers.h"
#include "starboard/nplb/testcase_helpers.h"
#include "starboard/system.h"
#include "testing/gtest/include/gtest/gtest.h"

Expand All @@ -45,6 +46,11 @@ TEST(SbDirectoryOpenTest, SunnyDay) {
#endif

TEST(SbDirectoryOpenTest, SunnyDayStaticContent) {
// TODO(b/380344836): Skip test case(s) not applicable to Android.
if (GetRuntimePlatform() == PlatformType::kPlatformTypeAndroid) {
GTEST_SKIP() << "Not applicable on Android";
}

for (auto dir_path : GetFileTestsDirectoryPaths()) {
SbFileError error = kSbFileErrorMax;
SbDirectory directory = SbDirectoryOpen(dir_path.c_str(), &error);
Expand Down
16 changes: 16 additions & 0 deletions starboard/nplb/drm_session_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "starboard/common/log.h"
#include "starboard/common/queue.h"
#include "starboard/nplb/drm_helpers.h"
#include "starboard/nplb/testcase_helpers.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace starboard {
Expand Down Expand Up @@ -285,6 +286,11 @@ void SbDrmSessionTest::OnSessionClosedFunc(SbDrmSystem drm_system,
}

TEST_F(SbDrmSessionTest, SunnyDay) {
// TODO(b/338229737): Skip test case(s) not applicable to Android.
if (GetRuntimePlatform() == PlatformType::kPlatformTypeAndroid) {
GTEST_SKIP() << "Not applicable on Android";
}

if (!SbDrmSystemIsValid(drm_system_)) {
SB_LOG(INFO) << "Skipping test, DRM system Widevine is not supported on "
"this platform.";
Expand Down Expand Up @@ -320,6 +326,11 @@ TEST_F(SbDrmSessionTest, SunnyDay) {
}

TEST_F(SbDrmSessionTest, CloseDrmSessionBeforeUpdateSession) {
// TODO(b/338229737): Skip test case(s) not applicable to Android.
if (GetRuntimePlatform() == PlatformType::kPlatformTypeAndroid) {
GTEST_SKIP() << "Not applicable on Android";
}

if (!SbDrmSystemIsValid(drm_system_)) {
SB_LOG(INFO) << "Skipping test, DRM system Widevine is not supported on "
"this platform.";
Expand Down Expand Up @@ -349,6 +360,11 @@ TEST_F(SbDrmSessionTest, CloseDrmSessionBeforeUpdateSession) {
}

TEST_F(SbDrmSessionTest, InvalidSessionUpdateRequestParams) {
// TODO(b/338229737): Skip test case(s) not applicable to Android.
if (GetRuntimePlatform() == PlatformType::kPlatformTypeAndroid) {
GTEST_SKIP() << "Not applicable on Android";
}

if (!SbDrmSystemIsValid(drm_system_)) {
SB_LOG(INFO) << "Skipping test, DRM system Widevine is not supported on "
"this platform.";
Expand Down
6 changes: 6 additions & 0 deletions starboard/nplb/file_get_path_info_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "starboard/configuration_constants.h"
#include "starboard/file.h"
#include "starboard/nplb/file_helpers.h"
#include "starboard/nplb/testcase_helpers.h"
#include "starboard/system.h"
#include "testing/gtest/include/gtest/gtest.h"

Expand Down Expand Up @@ -104,6 +105,11 @@ TEST(SbFileGetPathInfoTest, WorksOnStaticContentFiles) {
}

TEST(SbFileGetPathInfoTest, WorksOnStaticContentDirectories) {
// TODO(b/380344836): Skip test case(s) not applicable to Android.
if (GetRuntimePlatform() == PlatformType::kPlatformTypeAndroid) {
GTEST_SKIP() << "Not applicable on Android";
}

for (auto path : GetFileTestsDirectoryPaths()) {
SbFileInfo info = {0};
bool result = SbFileGetPathInfo(path.data(), &info);
Expand Down
6 changes: 6 additions & 0 deletions starboard/nplb/multiple_player_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "starboard/nplb/player_test_fixture.h"
#include "starboard/nplb/player_test_util.h"
#include "starboard/nplb/posix_compliance/posix_thread_helpers.h"
#include "starboard/nplb/testcase_helpers.h"
#include "starboard/testing/fake_graphics_context_provider.h"
#include "testing/gtest/include/gtest/gtest.h"

Expand Down Expand Up @@ -55,6 +56,11 @@ class MultiplePlayerTest
};

void MultiplePlayerTest::RunTest(const MultiplePlayerTestFunctor& functor) {
// TODO(b/368228941): Skip test case(s) not applicable to Android.
if (GetRuntimePlatform() == PlatformType::kPlatformTypeAndroid) {
GTEST_SKIP() << "Not applicable on Android";
}

const SbPlayerMultiplePlayerTestConfig& multiplayer_test_config = GetParam();
std::list<PlayerThread> player_threads;
for (const SbPlayerTestConfig& player_config : multiplayer_test_config) {
Expand Down
6 changes: 6 additions & 0 deletions starboard/nplb/player_get_audio_configuration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "starboard/string.h"
#include "starboard/testing/fake_graphics_context_provider.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "starboard/nplb/testcase_helpers.h"

#if SB_API_VERSION >= 15

Expand Down Expand Up @@ -155,6 +156,11 @@ TEST_P(SbPlayerGetAudioConfigurationTest, SunnyDay) {
}

TEST_P(SbPlayerGetAudioConfigurationTest, NoInput) {
// TODO(b/380031306): Skip test case(s) not applicable to Android.
if (GetRuntimePlatform() == PlatformType::kPlatformTypeAndroid) {
GTEST_SKIP() << "Not applicable on Android";
}

SbPlayerTestFixture player_fixture(GetParam(),
&fake_graphics_context_provider_);
if (HasFatalFailure()) {
Expand Down
11 changes: 11 additions & 0 deletions starboard/nplb/player_write_sample_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "starboard/string.h"
#include "starboard/testing/fake_graphics_context_provider.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "starboard/nplb/testcase_helpers.h"

namespace starboard {
namespace nplb {
Expand All @@ -47,6 +48,11 @@ TEST_P(SbPlayerWriteSampleTest, SeekAndDestroy) {
}

TEST_P(SbPlayerWriteSampleTest, NoInput) {
// TODO(b/380032222): Skip test case(s) not applicable to Android.
if (GetRuntimePlatform() == PlatformType::kPlatformTypeAndroid) {
GTEST_SKIP() << "Not applicable on Android";
}

SbPlayerTestFixture player_fixture(GetParam(),
&fake_graphics_context_provider_);
if (HasFatalFailure()) {
Expand Down Expand Up @@ -379,6 +385,11 @@ class SecondaryPlayerTestThread : public posix::AbstractTestThread {
};

TEST_P(SbPlayerWriteSampleTest, SecondaryPlayerTest) {
// TODO(b/380347735): Skip test case(s) not applicable to Android.
if (GetRuntimePlatform() == PlatformType::kPlatformTypeAndroid) {
GTEST_SKIP() << "Not applicable on Android";
}

// The secondary player should at least support h264 at 480p, 30fps and with
// a drm system.
const char* kMaxVideoCapabilities = "width=640; height=480; framerate=30;";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "starboard/configuration_constants.h"
#include "starboard/directory.h"
#include "starboard/nplb/file_helpers.h"
#include "starboard/nplb/testcase_helpers.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace starboard {
Expand All @@ -35,6 +36,11 @@ TEST(PosixDirectoryCanOpenTest, SunnyDay) {
}

TEST(PosixDirectoryCanOpenTest, SunnyDayStaticContent) {
// TODO(b/380030274): Skip test case(s) not applicable to Android.
if (GetRuntimePlatform() == PlatformType::kPlatformTypeAndroid) {
GTEST_SKIP() << "Not applicable on Android";
}

for (auto dir_path : GetFileTestsDirectoryPaths()) {
struct stat file_info;
stat(dir_path.c_str(), &file_info);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "starboard/directory.h"
#include "starboard/file.h"
#include "starboard/nplb/file_helpers.h"
#include "starboard/nplb/testcase_helpers.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace starboard {
Expand Down Expand Up @@ -97,6 +98,11 @@ TEST(PosixDirectoryGetNextTest, SunnyDay) {
}

TEST(PosixDirectoryGetNextTest, SunnyDayStaticContent) {
// TODO(b/380030274): Skip test case(s) not applicable to Android.
if (GetRuntimePlatform() == PlatformType::kPlatformTypeAndroid) {
GTEST_SKIP() << "Not applicable on Android";
}

std::string testdata_dir = GetFileTestsDataDir();
EXPECT_FALSE(testdata_dir.empty());
EXPECT_TRUE(FileExists(testdata_dir.c_str()))
Expand Down
6 changes: 6 additions & 0 deletions starboard/nplb/posix_compliance/posix_directory_open_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "starboard/directory.h"
#include "starboard/file.h"
#include "starboard/nplb/file_helpers.h"
#include "starboard/nplb/testcase_helpers.h"
#include "starboard/system.h"
#include "testing/gtest/include/gtest/gtest.h"

Expand All @@ -43,6 +44,11 @@ TEST(PosixDirectoryOpenTest, SunnyDay) {
}

TEST(PosixDirectoryOpenTest, SunnyDayStaticContent) {
// TODO(b/380030274): Skip test case(s) not applicable to Android.
if (GetRuntimePlatform() == PlatformType::kPlatformTypeAndroid) {
GTEST_SKIP() << "Not applicable on Android";
}

for (auto dir_path : GetFileTestsDirectoryPaths()) {
DIR* directory = opendir(dir_path.c_str());
EXPECT_TRUE(directory != NULL) << dir_path;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "starboard/configuration_constants.h"
#include "starboard/file.h"
#include "starboard/nplb/file_helpers.h"
#include "starboard/nplb/testcase_helpers.h"
#include "starboard/system.h"
#include "testing/gtest/include/gtest/gtest.h"

Expand Down Expand Up @@ -102,6 +103,11 @@ TEST(PosixFileGetPathInfoTest, WorksOnStaticContentFiles) {
}

TEST(PosixFileGetPathInfoTest, WorksOnStaticContentDirectories) {
// TODO(b/380030274): Skip test case(s) not applicable to Android.
if (GetRuntimePlatform() == PlatformType::kPlatformTypeAndroid) {
GTEST_SKIP() << "Not applicable on Android";
}

for (auto path : GetFileTestsDirectoryPaths()) {
struct stat info;
EXPECT_TRUE(stat(path.data(), &info) == 0);
Expand Down
55 changes: 55 additions & 0 deletions starboard/nplb/testcase_helpers.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Copyright 2025 The Cobalt Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef STARBOARD_NPLB_TESTCASE_HELPERS_H_
#define STARBOARD_NPLB_TESTCASE_HELPERS_H_

#include <string.h>
#include "starboard/system.h"
#include "starboard/common/log.h"

namespace starboard {
namespace nplb {

typedef enum PlatformType {
kPlatformTypeLinux,
kPlatformTypeAndroid,
kPlatformTypeUnknown
} PlatformType;

static PlatformType runtimePlatformType = PlatformType::kPlatformTypeUnknown;

static inline PlatformType GetRuntimePlatform() {
if (runtimePlatformType != PlatformType::kPlatformTypeUnknown) {
return runtimePlatformType;
}

// Set default platform type to Linux.
runtimePlatformType = PlatformType::kPlatformTypeLinux;

// Get runtime platform type from starboard.
const int bufSize = 256;
char platformStrBuf[bufSize];
SbSystemGetProperty(kSbSystemPropertyPlatformName, platformStrBuf, bufSize);

if (std::string(platformStrBuf).find("Android") != std::string::npos) {
runtimePlatformType = PlatformType::kPlatformTypeAndroid;
}
return runtimePlatformType;
}

} // namespace nplb
} // namespace starboard

#endif // STARBOARD_NPLB_TESTCASE_HELPERS_H_

0 comments on commit b4ad82a

Please sign in to comment.