From 5a4fc2503ca9d45c28c60723fdc71cba0f7ea968 Mon Sep 17 00:00:00 2001 From: raymes Date: Mon, 6 Oct 2014 12:59:45 -0700 Subject: [PATCH] Fix the ppapi test for FlashDRM 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} --- chrome/test/ppapi/ppapi_browsertest.cc | 8 +----- ppapi/tests/test_flash_drm.cc | 34 +++++++++++++++++--------- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/chrome/test/ppapi/ppapi_browsertest.cc b/chrome/test/ppapi/ppapi_browsertest.cc index 0268420763eac3..0c80b239753d55 100644 --- a/chrome/test/ppapi/ppapi_browsertest.cc +++ b/chrome/test/ppapi/ppapi_browsertest.cc @@ -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. diff --git a/ppapi/tests/test_flash_drm.cc b/ppapi/tests/test_flash_drm.cc index 8daf18d02e6c1d..d76c6401657a41 100644 --- a/ppapi/tests/test_flash_drm.cc +++ b/ppapi/tests/test_flash_drm.cc @@ -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), &info) == TRUE; +#else + // Not implemented for other platforms, should return false. + return !success; +#endif } +} // namespace + TestFlashDRM::TestFlashDRM(TestingInstance* instance) : TestCase(instance), callback_factory_(this) { @@ -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), &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(); }