Skip to content

Commit

Permalink
Fix the ppapi test for FlashDRM
Browse files Browse the repository at this point in the history
This fixes the FlashDRM ppapi test which was failing because the test was assuming
that the "Hmonitor" value would never be returned on Mac, but at some point it
was implemented but the test was never changed. This changes the test to assume
that a valid Hmonitor value will be returned on Mac (but doesn't actually check
what the value is).

BUG=419863

Review URL: https://codereview.chromium.org/626883002

Cr-Commit-Position: refs/heads/master@{#298298}
  • Loading branch information
raymes authored and Commit bot committed Oct 6, 2014
1 parent 0c5e8d1 commit 5a4fc25
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 19 deletions.
8 changes: 1 addition & 7 deletions chrome/test/ppapi/ppapi_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1312,13 +1312,7 @@ TEST_PPAPI_OUT_OF_PROCESS(PDF)
// TEST_PPAPI_OUT_OF_PROCESS(PlatformVerificationPrivate)
// #endif

#if defined(OS_MACOSX)
// http://crbug.com/419863
#define MAYBE_FlashDRM DISABLED_FlashDRM
#else
#define MAYBE_FlashDRM FlashDRM
#endif
IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, MAYBE_FlashDRM) {
IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, FlashDRM) {
RunTest(
#if (defined(OS_WIN) && defined(ENABLE_RLZ)) || defined(OS_CHROMEOS)
// Only implemented on Windows and ChromeOS currently.
Expand Down
34 changes: 22 additions & 12 deletions ppapi/tests/test_flash_drm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,26 @@ using pp::PassRef;
using pp::Var;

namespace {
const char kExepectedVoucherFilename[] = "plugin.vch";

const char kExepectedVoucherFilename[] = "plugin.vch";

// Check that the Hmonitor value is what it is expected to be for each platform.
bool CheckExpectedHmonitorValue(bool success, int64_t hmonitor) {
#if defined(PPAPI_OS_MACOSX)
// TODO(raymes): Verify the expected |hmonitor| value on Mac.
return success;
#elif defined(PPAPI_OS_WIN)
MONITORINFO info = { sizeof(info) };
return success &&
::GetMonitorInfo(reinterpret_cast<HMONITOR>(hmonitor), &info) == TRUE;
#else
// Not implemented for other platforms, should return false.
return !success;
#endif
}

} // namespace

TestFlashDRM::TestFlashDRM(TestingInstance* instance)
: TestCase(instance),
callback_factory_(this) {
Expand Down Expand Up @@ -76,20 +93,13 @@ std::string TestFlashDRM::TestGetDeviceID() {
std::string TestFlashDRM::TestGetHmonitor() {
DRM drm(instance_);
int64_t hmonitor;
#if defined(PPAPI_OS_WIN)
while (true) {
if (drm.GetHmonitor(&hmonitor)) {
MONITORINFO info = { sizeof(info) };
ASSERT_EQ(TRUE,
::GetMonitorInfo(reinterpret_cast<HMONITOR>(hmonitor), &info));
bool success = drm.GetHmonitor(&hmonitor);
if (CheckExpectedHmonitorValue(success, hmonitor))
break;
} else {
::Sleep(30);
}
else
PlatformSleep(30);
}
#else
ASSERT_FALSE(drm.GetHmonitor(&hmonitor));
#endif

PASS();
}
Expand Down

0 comments on commit 5a4fc25

Please sign in to comment.