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

Side by Side Diff: ui/views/widget/widget_unittest.cc

Issue 1849343003: mac: Remove IsOSSnowLeopard(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « ui/views/widget/native_widget_mac_interactive_uitest.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <algorithm> 5 #include <algorithm>
6 #include <set> 6 #include <set>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 // TODO(tdanderson): This utility function is used in different unittest 55 // TODO(tdanderson): This utility function is used in different unittest
56 // files. Move to a common location to avoid 56 // files. Move to a common location to avoid
57 // repeated code. 57 // repeated code.
58 gfx::Point ConvertPointFromWidgetToView(View* view, const gfx::Point& p) { 58 gfx::Point ConvertPointFromWidgetToView(View* view, const gfx::Point& p) {
59 gfx::Point tmp(p); 59 gfx::Point tmp(p);
60 View::ConvertPointToTarget(view->GetWidget()->GetRootView(), view, &tmp); 60 View::ConvertPointToTarget(view->GetWidget()->GetRootView(), view, &tmp);
61 return tmp; 61 return tmp;
62 } 62 }
63 63
64 // Helper function for Snow Leopard special cases to avoid #ifdef litter.
65 bool IsTestingSnowLeopard() {
66 #if defined(OS_MACOSX)
67 return base::mac::IsOSSnowLeopard();
68 #else
69 return false;
70 #endif
71 }
72
73 // This class can be used as a deleter for scoped_ptr<Widget> 64 // This class can be used as a deleter for scoped_ptr<Widget>
74 // to call function Widget::CloseNow automatically. 65 // to call function Widget::CloseNow automatically.
75 struct WidgetCloser { 66 struct WidgetCloser {
76 inline void operator()(Widget* widget) const { widget->CloseNow(); } 67 inline void operator()(Widget* widget) const { widget->CloseNow(); }
77 }; 68 };
78 69
79 using WidgetAutoclosePtr = scoped_ptr<Widget, WidgetCloser>; 70 using WidgetAutoclosePtr = scoped_ptr<Widget, WidgetCloser>;
80 71
81 } // namespace 72 } // namespace
82 73
(...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after
1154 EXPECT_EQ(bounds, toplevel->GetRestoredBounds()); 1145 EXPECT_EQ(bounds, toplevel->GetRestoredBounds());
1155 1146
1156 toplevel->Restore(); 1147 toplevel->Restore();
1157 RunPendingMessages(); 1148 RunPendingMessages();
1158 EXPECT_EQ(bounds, toplevel->GetWindowBoundsInScreen()); 1149 EXPECT_EQ(bounds, toplevel->GetWindowBoundsInScreen());
1159 EXPECT_EQ(bounds, toplevel->GetRestoredBounds()); 1150 EXPECT_EQ(bounds, toplevel->GetRestoredBounds());
1160 1151
1161 toplevel->SetFullscreen(true); 1152 toplevel->SetFullscreen(true);
1162 RunPendingMessages(); 1153 RunPendingMessages();
1163 1154
1164 if (IsTestingSnowLeopard()) { 1155 EXPECT_NE(toplevel->GetWindowBoundsInScreen(),
1165 // Fullscreen not implemented for Snow Leopard. 1156 toplevel->GetRestoredBounds());
1166 EXPECT_EQ(toplevel->GetWindowBoundsInScreen(),
1167 toplevel->GetRestoredBounds());
1168 } else {
1169 EXPECT_NE(toplevel->GetWindowBoundsInScreen(),
1170 toplevel->GetRestoredBounds());
1171 }
1172 EXPECT_EQ(bounds, toplevel->GetRestoredBounds()); 1157 EXPECT_EQ(bounds, toplevel->GetRestoredBounds());
1173 1158
1174 toplevel->SetFullscreen(false); 1159 toplevel->SetFullscreen(false);
1175 RunPendingMessages(); 1160 RunPendingMessages();
1176 EXPECT_EQ(bounds, toplevel->GetWindowBoundsInScreen()); 1161 EXPECT_EQ(bounds, toplevel->GetWindowBoundsInScreen());
1177 EXPECT_EQ(bounds, toplevel->GetRestoredBounds()); 1162 EXPECT_EQ(bounds, toplevel->GetRestoredBounds());
1178 } 1163 }
1179 1164
1180 // The key-event propagation from Widget happens differently on aura and 1165 // The key-event propagation from Widget happens differently on aura and
1181 // non-aura systems because of the difference in IME. So this test works only on 1166 // non-aura systems because of the difference in IME. So this test works only on
(...skipping 1881 matching lines...) Expand 10 before | Expand all | Expand 10 after
3063 widget->non_client_view()->SetFrameView(frame); // Owns |frame|. 3048 widget->non_client_view()->SetFrameView(frame); // Owns |frame|.
3064 3049
3065 widget->Maximize(); 3050 widget->Maximize();
3066 RunPendingMessages(); 3051 RunPendingMessages();
3067 3052
3068 EXPECT_FALSE(frame->fullscreen_layout_called()); 3053 EXPECT_FALSE(frame->fullscreen_layout_called());
3069 widget->SetFullscreen(true); 3054 widget->SetFullscreen(true);
3070 widget->Show(); 3055 widget->Show();
3071 RunPendingMessages(); 3056 RunPendingMessages();
3072 3057
3073 if (IsTestingSnowLeopard()) { 3058 EXPECT_TRUE(frame->fullscreen_layout_called());
3074 // Fullscreen is currently ignored on Snow Leopard.
3075 EXPECT_FALSE(frame->fullscreen_layout_called());
3076 } else {
3077 EXPECT_TRUE(frame->fullscreen_layout_called());
3078 }
3079 } 3059 }
3080 3060
3081 #if !defined(OS_CHROMEOS) 3061 #if !defined(OS_CHROMEOS)
3082 namespace { 3062 namespace {
3083 3063
3084 // Trivial WidgetObserverTest that invokes Widget::IsActive() from 3064 // Trivial WidgetObserverTest that invokes Widget::IsActive() from
3085 // OnWindowDestroying. 3065 // OnWindowDestroying.
3086 class IsActiveFromDestroyObserver : public WidgetObserver { 3066 class IsActiveFromDestroyObserver : public WidgetObserver {
3087 public: 3067 public:
3088 IsActiveFromDestroyObserver() {} 3068 IsActiveFromDestroyObserver() {}
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
3522 // Moving the child to a different widget should call the removals observer. 3502 // Moving the child to a different widget should call the removals observer.
3523 WidgetAutoclosePtr widget2(CreateTopLevelPlatformWidget()); 3503 WidgetAutoclosePtr widget2(CreateTopLevelPlatformWidget());
3524 widget2->client_view()->AddChildView(child); 3504 widget2->client_view()->AddChildView(child);
3525 EXPECT_TRUE(removals_observer.DidRemoveView(child)); 3505 EXPECT_TRUE(removals_observer.DidRemoveView(child));
3526 3506
3527 widget->RemoveRemovalsObserver(&removals_observer); 3507 widget->RemoveRemovalsObserver(&removals_observer);
3528 } 3508 }
3529 3509
3530 } // namespace test 3510 } // namespace test
3531 } // namespace views 3511 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/native_widget_mac_interactive_uitest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698