OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "mojo/services/view_manager/public/cpp/view_manager.h" | 5 #include "mojo/services/view_manager/public/cpp/view_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 | 574 |
575 View* view_; | 575 View* view_; |
576 View* last_gained_focus_; | 576 View* last_gained_focus_; |
577 View* last_lost_focus_; | 577 View* last_lost_focus_; |
578 | 578 |
579 MOJO_DISALLOW_COPY_AND_ASSIGN(FocusChangeObserver); | 579 MOJO_DISALLOW_COPY_AND_ASSIGN(FocusChangeObserver); |
580 }; | 580 }; |
581 | 581 |
582 } // namespace | 582 } // namespace |
583 | 583 |
584 | 584 TEST_F(ViewManagerTest, Focus) { |
585 // TODO(msw|alhaad|sky): Fix underlying flakiness here. http://crbug.com/460621 | |
586 TEST_F(ViewManagerTest, DISABLED_Focus) { | |
587 View* view1 = window_manager()->CreateView(); | 585 View* view1 = window_manager()->CreateView(); |
588 view1->SetVisible(true); | 586 view1->SetVisible(true); |
589 window_manager()->GetRoot()->AddChild(view1); | 587 window_manager()->GetRoot()->AddChild(view1); |
590 | 588 |
591 ViewManager* embedded = Embed(window_manager(), view1); | 589 ViewManager* embedded = Embed(window_manager(), view1); |
592 ASSERT_NE(nullptr, embedded); | 590 ASSERT_NE(nullptr, embedded); |
593 View* view11 = embedded->CreateView(); | 591 View* view11 = embedded->CreateView(); |
594 view11->SetVisible(true); | 592 view11->SetVisible(true); |
595 embedded->GetRoot()->AddChild(view11); | 593 embedded->GetRoot()->AddChild(view11); |
596 | 594 |
(...skipping 12 matching lines...) Expand all Loading... |
609 view11->SetFocus(); | 607 view11->SetFocus(); |
610 ASSERT_TRUE(DoRunLoopWithTimeout()); | 608 ASSERT_TRUE(DoRunLoopWithTimeout()); |
611 ASSERT_NE(nullptr, observer.last_gained_focus()); | 609 ASSERT_NE(nullptr, observer.last_gained_focus()); |
612 ASSERT_NE(nullptr, observer.last_lost_focus()); | 610 ASSERT_NE(nullptr, observer.last_lost_focus()); |
613 EXPECT_EQ(view11->id(), observer.last_gained_focus()->id()); | 611 EXPECT_EQ(view11->id(), observer.last_gained_focus()->id()); |
614 EXPECT_EQ(embedded->GetRoot()->id(), observer.last_lost_focus()->id()); | 612 EXPECT_EQ(embedded->GetRoot()->id(), observer.last_lost_focus()->id()); |
615 } | 613 } |
616 } | 614 } |
617 | 615 |
618 } // namespace mojo | 616 } // namespace mojo |
OLD | NEW |