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

Unified Diff: ui/window_snapshot/window_snapshot_mac_unittest.mm

Issue 10830135: Revert 149604 - Support calling GrabWindowSnapshot when no BrowserProcess instance is avaliable (eg… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 | « ui/window_snapshot/window_snapshot_mac.mm ('k') | ui/window_snapshot/window_snapshot_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/window_snapshot/window_snapshot_mac_unittest.mm
===================================================================
--- ui/window_snapshot/window_snapshot_mac_unittest.mm (revision 149605)
+++ ui/window_snapshot/window_snapshot_mac_unittest.mm (working copy)
@@ -1,49 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/window_snapshot/window_snapshot.h"
-
-#import <Cocoa/Cocoa.h>
-
-#include "base/memory/scoped_nsobject.h"
-#include "base/memory/scoped_ptr.h"
-#include "testing/platform_test.h"
-#include "ui/gfx/rect.h"
-
-namespace ui {
-namespace {
-
-typedef PlatformTest GrabWindowSnapshotTest;
-
-TEST_F(GrabWindowSnapshotTest, TestGrabWindowSnapshot) {
- // Launch a test window so we can take a snapshot.
- NSRect frame = NSMakeRect(0, 0, 400, 400);
- scoped_nsobject<NSWindow> window(
- [[NSWindow alloc] initWithContentRect:frame
- styleMask:NSBorderlessWindowMask
- backing:NSBackingStoreBuffered
- defer:NO]);
- [window setBackgroundColor:[NSColor whiteColor]];
- [window makeKeyAndOrderFront:NSApp];
-
- scoped_ptr<std::vector<unsigned char> > png_representation(
- new std::vector<unsigned char>);
- gfx::Rect bounds = gfx::Rect(0, 0, frame.size.width, frame.size.height);
- EXPECT_TRUE(GrabWindowSnapshot(window, png_representation.get(), bounds));
-
- // Copy png back into NSData object so we can make sure we grabbed a png.
- scoped_nsobject<NSData> image_data(
- [[NSData alloc] initWithBytes:&(*png_representation)[0]
- 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 red = 0, green = 0, blue = 0, alpha = 0;
- [color getRed:&red green:&green blue:&blue alpha:&alpha];
- EXPECT_GE(red + green + blue, 3.0);
-}
-
-} // namespace
-} // namespace ui
« no previous file with comments | « ui/window_snapshot/window_snapshot_mac.mm ('k') | ui/window_snapshot/window_snapshot_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698