| 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 ViewManagerTest() | 188 ViewManagerTest() |
| 189 : most_recent_view_manager_(nullptr), window_manager_(nullptr) {} | 189 : most_recent_view_manager_(nullptr), window_manager_(nullptr) {} |
| 190 | 190 |
| 191 // Overridden from ApplicationDelegate: | 191 // Overridden from ApplicationDelegate: |
| 192 void Initialize(ApplicationImpl* app) override { | 192 void Initialize(ApplicationImpl* app) override { |
| 193 view_manager_client_factory_.reset( | 193 view_manager_client_factory_.reset( |
| 194 new ViewManagerClientFactory(app->shell(), this)); | 194 new ViewManagerClientFactory(app->shell(), this)); |
| 195 } | 195 } |
| 196 | 196 |
| 197 // ApplicationDelegate implementation. | 197 // ApplicationDelegate implementation. |
| 198 bool ConfigureIncomingConnection(ApplicationConnection* connection) override { | 198 bool ConfigureIncomingConnection(ApplicationConnection* connection, const std:
:string& url) override { |
| 199 connection->AddService(view_manager_client_factory_.get()); | 199 connection->AddService(view_manager_client_factory_.get()); |
| 200 return true; | 200 return true; |
| 201 } | 201 } |
| 202 | 202 |
| 203 ViewManager* window_manager() { return window_manager_; } | 203 ViewManager* window_manager() { return window_manager_; } |
| 204 | 204 |
| 205 // Embeds another version of the test app @ view; returns nullptr on timeout. | 205 // Embeds another version of the test app @ view; returns nullptr on timeout. |
| 206 ViewManager* Embed(ViewManager* view_manager, View* view) { | 206 ViewManager* Embed(ViewManager* view_manager, View* view) { |
| 207 DCHECK_EQ(view_manager, view->view_manager()); | 207 DCHECK_EQ(view_manager, view->view_manager()); |
| 208 most_recent_view_manager_ = nullptr; | 208 most_recent_view_manager_ = nullptr; |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 view11->SetFocus(); | 607 view11->SetFocus(); |
| 608 ASSERT_TRUE(DoRunLoopWithTimeout()); | 608 ASSERT_TRUE(DoRunLoopWithTimeout()); |
| 609 ASSERT_NE(nullptr, observer.last_gained_focus()); | 609 ASSERT_NE(nullptr, observer.last_gained_focus()); |
| 610 ASSERT_NE(nullptr, observer.last_lost_focus()); | 610 ASSERT_NE(nullptr, observer.last_lost_focus()); |
| 611 EXPECT_EQ(view11->id(), observer.last_gained_focus()->id()); | 611 EXPECT_EQ(view11->id(), observer.last_gained_focus()->id()); |
| 612 EXPECT_EQ(embedded->GetRoot()->id(), observer.last_lost_focus()->id()); | 612 EXPECT_EQ(embedded->GetRoot()->id(), observer.last_lost_focus()->id()); |
| 613 } | 613 } |
| 614 } | 614 } |
| 615 | 615 |
| 616 } // namespace mojo | 616 } // namespace mojo |
| OLD | NEW |