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

Side by Side Diff: ui/views/controls/native/native_view_host_aura_unittest.cc

Issue 517143003: Hide NativeViewHostAura correctly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add test Created 6 years, 3 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "ui/views/controls/native/native_view_host_aura.h" 5 #include "ui/views/controls/native/native_view_host_aura.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "ui/aura/client/aura_constants.h" 9 #include "ui/aura/client/aura_constants.h"
10 #include "ui/aura/window.h" 10 #include "ui/aura/window.h"
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 EXPECT_EQ(NativeViewHostWindowObserver::EVENT_SHOWN, 367 EXPECT_EQ(NativeViewHostWindowObserver::EVENT_SHOWN,
368 test_observer.events()[2].type); 368 test_observer.events()[2].type);
369 EXPECT_EQ(clipping_window(), test_observer.events()[2].window); 369 EXPECT_EQ(clipping_window(), test_observer.events()[2].window);
370 EXPECT_EQ(gfx::Rect(10, 10, 80, 80).ToString(), 370 EXPECT_EQ(gfx::Rect(10, 10, 80, 80).ToString(),
371 test_observer.events()[2].bounds.ToString()); 371 test_observer.events()[2].bounds.ToString());
372 372
373 child()->GetNativeView()->RemoveObserver(&test_observer); 373 child()->GetNativeView()->RemoveObserver(&test_observer);
374 DestroyHost(); 374 DestroyHost();
375 } 375 }
376 376
377 // Ensure the clipping window is hidden with the native view. This is a
378 // regression test for https://crbug.com/408877.
379 TEST_F(NativeViewHostAuraTest, SimpleShowAndHide) {
380 CreateHost();
381
382 toplevel()->SetBounds(gfx::Rect(20, 20, 100, 100));
383 toplevel()->Show();
384
385 host()->SetBounds(10, 10, 80, 80);
386 EXPECT_TRUE(clipping_window()->IsVisible());
387 EXPECT_TRUE(child()->IsVisible());
388
389 host()->SetVisible(false);
390 EXPECT_FALSE(clipping_window()->IsVisible());
391 EXPECT_FALSE(child()->IsVisible());
392
393 DestroyHost();
394 DestroyTopLevel();
395 }
396
377 } // namespace views 397 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698