summaryrefslogtreecommitdiffstats
path: root/ppapi/tests/test_flash_drm.cc
diff options
context:
space:
mode:
authorjackhou <jackhou@chromium.org>2014-10-06 20:22:50 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-07 03:23:43 +0000
commit0edd109f14d49b8580627bfbf13404d5523d9c3e (patch)
treee3919bc7388b15ffef7ca428f741c42678072651 /ppapi/tests/test_flash_drm.cc
parentd42a8f8372389ff80a2f0f55b8826318a6ed2c93 (diff)
downloadchromium_src-0edd109f14d49b8580627bfbf13404d5523d9c3e.zip
chromium_src-0edd109f14d49b8580627bfbf13404d5523d9c3e.tar.gz
chromium_src-0edd109f14d49b8580627bfbf13404d5523d9c3e.tar.bz2
Revert of Revert of Fix the ppapi test for FlashDRM (patchset #1 id:1 of https://codereview.chromium.org/632133002/)
Reason for revert: This CL was not the cause. Actual fix here: https://codereview.chromium.org/630963003 Original issue's description: > Revert of Fix the ppapi test for FlashDRM (patchset #1 id:1 of https://codereview.chromium.org/626883002/) > > Reason for revert: > Suspecting this CL broke the following: > > https://build.chromium.org/p/chromium.memory/builders/Mac%20ASan%2064%20Tests%20%281%29/builds/2456 > > Original issue's description: > > 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 > > > > Committed: https://crrev.com/5a4fc2503ca9d45c28c60723fdc71cba0f7ea968 > > Cr-Commit-Position: refs/heads/master@{#298298} > > TBR=bbudge@chromium.org,raymes@chromium.org > NOTREECHECKS=true > NOTRY=true > BUG=419863 > > Committed: https://crrev.com/886aeccd3824618309ccce5eabb2a70241073bc9 > Cr-Commit-Position: refs/heads/master@{#298316} TBR=bbudge@chromium.org,raymes@chromium.org NOTREECHECKS=true NOTRY=true BUG=419863 Review URL: https://codereview.chromium.org/630323002 Cr-Commit-Position: refs/heads/master@{#298349}
Diffstat (limited to 'ppapi/tests/test_flash_drm.cc')
-rw-r--r--ppapi/tests/test_flash_drm.cc34
1 files changed, 22 insertions, 12 deletions
diff --git a/ppapi/tests/test_flash_drm.cc b/ppapi/tests/test_flash_drm.cc
index 8daf18d..d76c640 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>(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>(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();
}