Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4302)

Unified Diff: chrome/browser/ui/window_snapshot/window_snapshot_mac_unittest.mm

Issue 10957031: GrabWindowSnapshotTest.TestGrabWindowSnapshot fails in HighDPI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: UL Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/window_snapshot/window_snapshot_mac_unittest.mm
diff --git a/chrome/browser/ui/window_snapshot/window_snapshot_mac_unittest.mm b/chrome/browser/ui/window_snapshot/window_snapshot_mac_unittest.mm
index 638aecfccca9d0f51968e1f6e42b4c2748ef2813..c42ffba573f95005fd8c8c8b540abde0381d250e 100644
--- a/chrome/browser/ui/window_snapshot/window_snapshot_mac_unittest.mm
+++ b/chrome/browser/ui/window_snapshot/window_snapshot_mac_unittest.mm
@@ -11,6 +11,15 @@
#include "testing/platform_test.h"
#include "ui/gfx/rect.h"
+#if !defined(MAC_OS_X_VERSION_10_7) || \
+ MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
+
+@interface NSWindow (LionAPI)
+- (CGFloat)backingScaleFactor;
+@end
+
+#endif // 10.7
+
namespace chrome {
namespace {
@@ -39,8 +48,11 @@ TEST_F(GrabWindowSnapshotTest, TestGrabWindowSnapshot) {
length:png_representation->size()]);
NSBitmapImageRep* rep = [NSBitmapImageRep imageRepWithData:image_data.get()];
EXPECT_TRUE([rep isKindOfClass:[NSBitmapImageRep class]]);
- EXPECT_TRUE(CGImageGetWidth([rep CGImage]) == 400);
- NSColor* color = [rep colorAtX:200 y:200];
+ CGFloat scaleFactor = 1.0f;
+ if ([window respondsToSelector:@selector(backingScaleFactor)])
+ scaleFactor = [window backingScaleFactor];
+ EXPECT_EQ(400 * scaleFactor, CGImageGetWidth([rep CGImage]));
+ NSColor* color = [rep colorAtX:200 * scaleFactor y:200 * scaleFactor];
CGFloat red = 0, green = 0, blue = 0, alpha = 0;
[color getRed:&red green:&green blue:&blue alpha:&alpha];
EXPECT_GE(red + green + blue, 3.0);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698