| 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 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| 585 // TODO(msw|alhaad|sky): Fix underlying flakiness here. http://crbug.com/460621 | 585 TEST_F(ViewManagerTest, Focus) { |
| 586 TEST_F(ViewManagerTest, DISABLED_Focus) { | |
| 587 View* view1 = window_manager()->CreateView(); | 586 View* view1 = window_manager()->CreateView(); |
| 588 view1->SetVisible(true); | 587 view1->SetVisible(true); |
| 589 window_manager()->GetRoot()->AddChild(view1); | 588 window_manager()->GetRoot()->AddChild(view1); |
| 590 | 589 |
| 591 ViewManager* embedded = Embed(window_manager(), view1); | 590 ViewManager* embedded = Embed(window_manager(), view1); |
| 592 ASSERT_NE(nullptr, embedded); | 591 ASSERT_NE(nullptr, embedded); |
| 593 View* view11 = embedded->CreateView(); | 592 View* view11 = embedded->CreateView(); |
| 594 view11->SetVisible(true); | 593 view11->SetVisible(true); |
| 595 embedded->GetRoot()->AddChild(view11); | 594 embedded->GetRoot()->AddChild(view11); |
| 596 | 595 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 609 view11->SetFocus(); | 608 view11->SetFocus(); |
| 610 ASSERT_TRUE(DoRunLoopWithTimeout()); | 609 ASSERT_TRUE(DoRunLoopWithTimeout()); |
| 611 ASSERT_NE(nullptr, observer.last_gained_focus()); | 610 ASSERT_NE(nullptr, observer.last_gained_focus()); |
| 612 ASSERT_NE(nullptr, observer.last_lost_focus()); | 611 ASSERT_NE(nullptr, observer.last_lost_focus()); |
| 613 EXPECT_EQ(view11->id(), observer.last_gained_focus()->id()); | 612 EXPECT_EQ(view11->id(), observer.last_gained_focus()->id()); |
| 614 EXPECT_EQ(embedded->GetRoot()->id(), observer.last_lost_focus()->id()); | 613 EXPECT_EQ(embedded->GetRoot()->id(), observer.last_lost_focus()->id()); |
| 615 } | 614 } |
| 616 } | 615 } |
| 617 | 616 |
| 618 } // namespace mojo | 617 } // namespace mojo |
| OLD | NEW |