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

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

Issue 286733002: [Refactor] Consolidate the logic for whether a widget can be activated. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « ui/views/widget/native_widget_aura.cc ('k') | ui/views/widget/widget.h » ('j') | 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 "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
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
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
OLDNEW
« no previous file with comments | « ui/views/widget/native_widget_aura.cc ('k') | ui/views/widget/widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698