OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "extensions/browser/app_window/native_app_window.h" | 5 #include "extensions/browser/app_window/native_app_window.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #import "base/mac/foundation_util.h" | 9 #import "base/mac/foundation_util.h" |
10 #import "base/mac/mac_util.h" | 10 #import "base/mac/mac_util.h" |
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 } | 631 } |
632 | 632 |
633 IN_PROC_BROWSER_TEST_P(NativeAppWindowCocoaBrowserTest, ControlsFrameless) { | 633 IN_PROC_BROWSER_TEST_P(NativeAppWindowCocoaBrowserTest, ControlsFrameless) { |
634 TestControls(CreateTestAppWindow("{\"frame\": \"none\"}")); | 634 TestControls(CreateTestAppWindow("{\"frame\": \"none\"}")); |
635 } | 635 } |
636 | 636 |
637 namespace { | 637 namespace { |
638 | 638 |
639 // Convert a color constant to an NSColor that can be compared with |bitmap|. | 639 // Convert a color constant to an NSColor that can be compared with |bitmap|. |
640 NSColor* ColorInBitmapColorSpace(SkColor color, NSBitmapImageRep* bitmap) { | 640 NSColor* ColorInBitmapColorSpace(SkColor color, NSBitmapImageRep* bitmap) { |
641 return [gfx::SkColorToSRGBNSColor(color) | 641 return [skia::SkColorToSRGBNSColor(color) |
642 colorUsingColorSpace:[bitmap colorSpace]]; | 642 colorUsingColorSpace:[bitmap colorSpace]]; |
643 } | 643 } |
644 | 644 |
645 // Take a screenshot of the window, including its native frame. | 645 // Take a screenshot of the window, including its native frame. |
646 NSBitmapImageRep* ScreenshotNSWindow(NSWindow* window) { | 646 NSBitmapImageRep* ScreenshotNSWindow(NSWindow* window) { |
647 // When building with 10.10 SDK and running on 10.9, -[NSView | 647 // When building with 10.10 SDK and running on 10.9, -[NSView |
648 // cacheDisplayInRect] does not seem to capture subviews. This seems related | 648 // cacheDisplayInRect] does not seem to capture subviews. This seems related |
649 // to the frame view having a layer with 10.10 SDK, but is probably a bug | 649 // to the frame view having a layer with 10.10 SDK, but is probably a bug |
650 // since it doesn't manifest on 10.10. See http://crbug.com/508722. | 650 // since it doesn't manifest on 10.10. See http://crbug.com/508722. |
651 // In this case, take a screenshot using the CGWindowList API instead. The | 651 // In this case, take a screenshot using the CGWindowList API instead. The |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 [expected_color getComponents:expected_components]; | 709 [expected_color getComponents:expected_components]; |
710 [color getComponents:color_components]; | 710 [color getComponents:color_components]; |
711 EXPECT_NEAR(expected_components[0], color_components[0], 0.01); | 711 EXPECT_NEAR(expected_components[0], color_components[0], 0.01); |
712 EXPECT_NEAR(expected_components[1], color_components[1], 0.01); | 712 EXPECT_NEAR(expected_components[1], color_components[1], 0.01); |
713 EXPECT_NEAR(expected_components[2], color_components[2], 0.01); | 713 EXPECT_NEAR(expected_components[2], color_components[2], 0.01); |
714 } | 714 } |
715 | 715 |
716 INSTANTIATE_TEST_CASE_P(NativeAppWindowCocoaBrowserTestInstance, | 716 INSTANTIATE_TEST_CASE_P(NativeAppWindowCocoaBrowserTestInstance, |
717 NativeAppWindowCocoaBrowserTest, | 717 NativeAppWindowCocoaBrowserTest, |
718 ::testing::Bool()); | 718 ::testing::Bool()); |
OLD | NEW |