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 "ui/views/widget/native_widget_aura.h" | 5 #include "ui/views/widget/native_widget_aura.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 EXPECT_TRUE(window->GetProperty(aura::client::kDrawAttentionKey)); | 426 EXPECT_TRUE(window->GetProperty(aura::client::kDrawAttentionKey)); |
427 widget->Activate(); | 427 widget->Activate(); |
428 EXPECT_FALSE(window->GetProperty(aura::client::kDrawAttentionKey)); | 428 EXPECT_FALSE(window->GetProperty(aura::client::kDrawAttentionKey)); |
429 } | 429 } |
430 | 430 |
431 TEST_F(NativeWidgetAuraTest, NoCrashOnThemeAfterClose) { | 431 TEST_F(NativeWidgetAuraTest, NoCrashOnThemeAfterClose) { |
432 scoped_ptr<aura::Window> parent(new aura::Window(NULL)); | 432 scoped_ptr<aura::Window> parent(new aura::Window(NULL)); |
433 parent->Init(aura::WINDOW_LAYER_NOT_DRAWN); | 433 parent->Init(aura::WINDOW_LAYER_NOT_DRAWN); |
434 parent->SetBounds(gfx::Rect(0, 0, 480, 320)); | 434 parent->SetBounds(gfx::Rect(0, 0, 480, 320)); |
435 scoped_ptr<Widget> widget(new Widget()); | 435 scoped_ptr<Widget> widget(new Widget()); |
436 NativeWidgetAura* window = Init(parent.get(), widget.get()); | 436 Init(parent.get(), widget.get()); |
437 window->Show(); | 437 widget->Show(); |
438 window->Close(); | 438 widget->Close(); |
439 base::MessageLoop::current()->RunUntilIdle(); | 439 base::MessageLoop::current()->RunUntilIdle(); |
440 widget->GetNativeTheme(); // Shouldn't crash. | 440 widget->GetNativeTheme(); // Shouldn't crash. |
441 } | 441 } |
442 | 442 |
443 // Used to track calls to WidgetDelegate::OnWidgetMove(). | 443 // Used to track calls to WidgetDelegate::OnWidgetMove(). |
444 class MoveTestWidgetDelegate : public WidgetDelegateView { | 444 class MoveTestWidgetDelegate : public WidgetDelegateView { |
445 public: | 445 public: |
446 MoveTestWidgetDelegate() : got_move_(false) {} | 446 MoveTestWidgetDelegate() : got_move_(false) {} |
447 virtual ~MoveTestWidgetDelegate() {} | 447 virtual ~MoveTestWidgetDelegate() {} |
448 | 448 |
(...skipping 24 matching lines...) Expand all Loading... |
473 delegate->ClearGotMove(); | 473 delegate->ClearGotMove(); |
474 // Simulate a maximize with animation. | 474 // Simulate a maximize with animation. |
475 delete widget->GetNativeView()->RecreateLayer().release(); | 475 delete widget->GetNativeView()->RecreateLayer().release(); |
476 widget->SetBounds(gfx::Rect(0, 0, 500, 500)); | 476 widget->SetBounds(gfx::Rect(0, 0, 500, 500)); |
477 EXPECT_TRUE(delegate->got_move()); | 477 EXPECT_TRUE(delegate->got_move()); |
478 widget->CloseNow(); | 478 widget->CloseNow(); |
479 } | 479 } |
480 | 480 |
481 } // namespace | 481 } // namespace |
482 } // namespace views | 482 } // namespace views |
OLD | NEW |