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/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "mojo/public/cpp/application/application_connection.h" | 10 #include "mojo/public/cpp/application/application_connection.h" |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 QuitRunLoop(); | 418 QuitRunLoop(); |
419 } | 419 } |
420 | 420 |
421 View* view_; | 421 View* view_; |
422 | 422 |
423 MOJO_DISALLOW_COPY_AND_ASSIGN(VisibilityChangeObserver); | 423 MOJO_DISALLOW_COPY_AND_ASSIGN(VisibilityChangeObserver); |
424 }; | 424 }; |
425 | 425 |
426 } // namespace | 426 } // namespace |
427 | 427 |
428 // TODO(alhaad): Re-enable this once | 428 TEST_F(ViewManagerTest, Visible) { |
429 // ViewManagerClientImpl::OnViewVisibilityChanged() does not cause a race | |
430 // condition when called from two clients. | |
431 TEST_F(ViewManagerTest, DISABLED_Visible) { | |
432 View* view1 = window_manager()->CreateView(); | 429 View* view1 = window_manager()->CreateView(); |
433 view1->SetVisible(true); | 430 view1->SetVisible(true); |
434 window_manager()->GetRoot()->AddChild(view1); | 431 window_manager()->GetRoot()->AddChild(view1); |
435 | 432 |
436 // Embed another app and verify initial state. | 433 // Embed another app and verify initial state. |
437 ViewManager* embedded = Embed(window_manager(), view1); | 434 ViewManager* embedded = Embed(window_manager(), view1); |
438 ASSERT_NE(nullptr, embedded->GetRoot()); | 435 ASSERT_NE(nullptr, embedded->GetRoot()); |
439 View* embedded_root = embedded->GetRoot(); | 436 View* embedded_root = embedded->GetRoot(); |
440 EXPECT_TRUE(embedded_root->visible()); | 437 EXPECT_TRUE(embedded_root->visible()); |
441 EXPECT_TRUE(embedded_root->IsDrawn()); | 438 EXPECT_TRUE(embedded_root->IsDrawn()); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 view11->SetFocus(); | 574 view11->SetFocus(); |
578 DoRunLoop(); | 575 DoRunLoop(); |
579 ASSERT_NE(nullptr, observer.last_gained_focus()); | 576 ASSERT_NE(nullptr, observer.last_gained_focus()); |
580 ASSERT_NE(nullptr, observer.last_lost_focus()); | 577 ASSERT_NE(nullptr, observer.last_lost_focus()); |
581 EXPECT_EQ(view11->id(), observer.last_gained_focus()->id()); | 578 EXPECT_EQ(view11->id(), observer.last_gained_focus()->id()); |
582 EXPECT_EQ(embedded->GetRoot()->id(), observer.last_lost_focus()->id()); | 579 EXPECT_EQ(embedded->GetRoot()->id(), observer.last_lost_focus()->id()); |
583 } | 580 } |
584 } | 581 } |
585 | 582 |
586 } // namespace mojo | 583 } // namespace mojo |
OLD | NEW |