| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #import "ui/views/widget/native_widget_mac.h" | 5 #import "ui/views/widget/native_widget_mac.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 int paint_count_; | 156 int paint_count_; |
| 157 | 157 |
| 158 DISALLOW_COPY_AND_ASSIGN(PaintCountView); | 158 DISALLOW_COPY_AND_ASSIGN(PaintCountView); |
| 159 }; | 159 }; |
| 160 | 160 |
| 161 // Test minimized states triggered externally, implied visibility and restored | 161 // Test minimized states triggered externally, implied visibility and restored |
| 162 // bounds whilst minimized. | 162 // bounds whilst minimized. |
| 163 TEST_F(NativeWidgetMacTest, MiniaturizeExternally) { | 163 TEST_F(NativeWidgetMacTest, MiniaturizeExternally) { |
| 164 Widget* widget = new Widget; | 164 Widget* widget = new Widget; |
| 165 Widget::InitParams init_params(Widget::InitParams::TYPE_WINDOW); | 165 Widget::InitParams init_params(Widget::InitParams::TYPE_WINDOW); |
| 166 // Don't add a layer, so that calls to paint can be observed synchronously. | 166 // Make the layer not drawn, so that calls to paint can be observed |
| 167 init_params.layer_type = aura::WINDOW_LAYER_NONE; | 167 // synchronously. |
| 168 init_params.layer_type = ui::LAYER_NOT_DRAWN; |
| 168 widget->Init(init_params); | 169 widget->Init(init_params); |
| 169 | 170 |
| 170 PaintCountView* view = new PaintCountView(); | 171 PaintCountView* view = new PaintCountView(); |
| 171 widget->GetContentsView()->AddChildView(view); | 172 widget->GetContentsView()->AddChildView(view); |
| 172 NSWindow* ns_window = widget->GetNativeWindow(); | 173 NSWindow* ns_window = widget->GetNativeWindow(); |
| 173 WidgetChangeObserver observer(widget); | 174 WidgetChangeObserver observer(widget); |
| 174 | 175 |
| 175 widget->SetBounds(gfx::Rect(100, 100, 300, 300)); | 176 widget->SetBounds(gfx::Rect(100, 100, 300, 300)); |
| 176 | 177 |
| 177 EXPECT_TRUE(view->IsDrawn()); | 178 EXPECT_TRUE(view->IsDrawn()); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 NSRect nsrect = gfx::ScreenRectToNSRect(screen_rect); | 359 NSRect nsrect = gfx::ScreenRectToNSRect(screen_rect); |
| 359 NSPoint midpoint = NSMakePoint(NSMidX(nsrect), NSMidY(nsrect)); | 360 NSPoint midpoint = NSMakePoint(NSMidX(nsrect), NSMidY(nsrect)); |
| 360 | 361 |
| 361 id hit = [widget->GetNativeWindow() accessibilityHitTest:midpoint]; | 362 id hit = [widget->GetNativeWindow() accessibilityHitTest:midpoint]; |
| 362 id title = [hit accessibilityAttributeValue:NSAccessibilityTitleAttribute]; | 363 id title = [hit accessibilityAttributeValue:NSAccessibilityTitleAttribute]; |
| 363 EXPECT_NSEQ(title, @"Green"); | 364 EXPECT_NSEQ(title, @"Green"); |
| 364 } | 365 } |
| 365 | 366 |
| 366 } // namespace test | 367 } // namespace test |
| 367 } // namespace views | 368 } // namespace views |
| OLD | NEW |