| OLD | NEW |
| 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/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 | 237 |
| 238 toplevel->Show(); | 238 toplevel->Show(); |
| 239 | 239 |
| 240 EXPECT_TRUE(toplevel->IsVisible()); | 240 EXPECT_TRUE(toplevel->IsVisible()); |
| 241 EXPECT_TRUE(child->IsVisible()); | 241 EXPECT_TRUE(child->IsVisible()); |
| 242 | 242 |
| 243 toplevel->CloseNow(); | 243 toplevel->CloseNow(); |
| 244 // |child| should be automatically destroyed with |toplevel|. | 244 // |child| should be automatically destroyed with |toplevel|. |
| 245 } | 245 } |
| 246 | 246 |
| 247 #if defined(OS_WIN) && !defined(USE_AURA) | |
| 248 // On Windows, it is possible to have child window that are TYPE_POPUP. Unlike | |
| 249 // regular child windows, these should be created as hidden and must be shown | |
| 250 // explicitly. | |
| 251 TEST_F(WidgetTest, Visibility_ChildPopup) { | |
| 252 Widget* toplevel = CreateTopLevelPlatformWidget(); | |
| 253 Widget* child_popup = CreateChildPopupPlatformWidget( | |
| 254 toplevel->GetNativeView()); | |
| 255 | |
| 256 EXPECT_FALSE(toplevel->IsVisible()); | |
| 257 EXPECT_FALSE(child_popup->IsVisible()); | |
| 258 | |
| 259 toplevel->Show(); | |
| 260 | |
| 261 EXPECT_TRUE(toplevel->IsVisible()); | |
| 262 EXPECT_FALSE(child_popup->IsVisible()); | |
| 263 | |
| 264 child_popup->Show(); | |
| 265 | |
| 266 EXPECT_TRUE(child_popup->IsVisible()); | |
| 267 | |
| 268 toplevel->CloseNow(); | |
| 269 // |child_popup| should be automatically destroyed with |toplevel|. | |
| 270 } | |
| 271 #endif | |
| 272 | |
| 273 //////////////////////////////////////////////////////////////////////////////// | 247 //////////////////////////////////////////////////////////////////////////////// |
| 274 // Widget ownership tests. | 248 // Widget ownership tests. |
| 275 // | 249 // |
| 276 // Tests various permutations of Widget ownership specified in the | 250 // Tests various permutations of Widget ownership specified in the |
| 277 // InitParams::Ownership param. | 251 // InitParams::Ownership param. |
| 278 | 252 |
| 279 // A WidgetTest that supplies a toplevel widget for NativeWidget to parent to. | 253 // A WidgetTest that supplies a toplevel widget for NativeWidget to parent to. |
| 280 class WidgetOwnershipTest : public WidgetTest { | 254 class WidgetOwnershipTest : public WidgetTest { |
| 281 public: | 255 public: |
| 282 WidgetOwnershipTest() {} | 256 WidgetOwnershipTest() {} |
| (...skipping 2028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2311 EXPECT_EQ(GetWidgetShowState(widget), ui::SHOW_STATE_NORMAL); | 2285 EXPECT_EQ(GetWidgetShowState(widget), ui::SHOW_STATE_NORMAL); |
| 2312 | 2286 |
| 2313 widget->CloseNow(); | 2287 widget->CloseNow(); |
| 2314 widget2.CloseNow(); | 2288 widget2.CloseNow(); |
| 2315 } | 2289 } |
| 2316 | 2290 |
| 2317 #endif | 2291 #endif |
| 2318 | 2292 |
| 2319 } // namespace test | 2293 } // namespace test |
| 2320 } // namespace views | 2294 } // namespace views |
| OLD | NEW |