| OLD | NEW | 
|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <memory> | 5 #include <memory> | 
| 6 | 6 | 
| 7 #include "base/macros.h" | 7 #include "base/macros.h" | 
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" | 
| 9 #include "mojo/public/cpp/bindings/binding.h" | 9 #include "mojo/public/cpp/bindings/binding.h" | 
| 10 #include "services/navigation/public/interfaces/view.mojom.h" | 10 #include "services/navigation/public/interfaces/view.mojom.h" | 
| 11 #include "services/service_manager/public/cpp/service.h" | 11 #include "services/service_manager/public/cpp/service.h" | 
| 12 #include "services/service_manager/public/cpp/service_test.h" | 12 #include "services/service_manager/public/cpp/service_test.h" | 
| 13 | 13 | 
| 14 namespace navigation { | 14 namespace navigation { | 
| 15 | 15 | 
| 16 class NavigationTest : public service_manager::test::ServiceTest, | 16 class NavigationTest : public service_manager::test::ServiceTest, | 
| 17                        public mojom::ViewClient { | 17                        public mojom::ViewClient { | 
| 18  public: | 18  public: | 
| 19   NavigationTest() | 19   NavigationTest() | 
| 20       : service_manager::test::ServiceTest("navigation_unittests"), | 20       : service_manager::test::ServiceTest("navigation_unittests"), | 
| 21         binding_(this) {} | 21         binding_(this) {} | 
| 22   ~NavigationTest() override {} | 22   ~NavigationTest() override {} | 
| 23 | 23 | 
| 24  protected: | 24  protected: | 
| 25    void SetUp() override { | 25    void SetUp() override { | 
| 26      service_manager::test::ServiceTest::SetUp(); | 26      service_manager::test::ServiceTest::SetUp(); | 
| 27      window_manager_connection_ = connector()->Connect("test_wm"); | 27      connector()->StartService("test_wm"); | 
| 28    } | 28    } | 
| 29 | 29 | 
| 30   mojom::ViewClientPtr GetViewClient() { | 30   mojom::ViewClientPtr GetViewClient() { | 
| 31     return binding_.CreateInterfacePtrAndBind(); | 31     return binding_.CreateInterfacePtrAndBind(); | 
| 32   } | 32   } | 
| 33 | 33 | 
| 34   void QuitOnLoadingStateChange(base::RunLoop* loop) { | 34   void QuitOnLoadingStateChange(base::RunLoop* loop) { | 
| 35     loop_ = loop; | 35     loop_ = loop; | 
| 36   } | 36   } | 
| 37 | 37 | 
| (...skipping 21 matching lines...) Expand all  Loading... | 
| 59   void NavigationCommitted( | 59   void NavigationCommitted( | 
| 60       mojom::NavigationCommittedDetailsPtr details, | 60       mojom::NavigationCommittedDetailsPtr details, | 
| 61       int current_index) override {} | 61       int current_index) override {} | 
| 62   void NavigationEntryChanged(mojom::NavigationEntryPtr entry, | 62   void NavigationEntryChanged(mojom::NavigationEntryPtr entry, | 
| 63                               int entry_index) override {} | 63                               int entry_index) override {} | 
| 64   void NavigationListPruned(bool from_front, int count) override {} | 64   void NavigationListPruned(bool from_front, int count) override {} | 
| 65 | 65 | 
| 66   int load_count_ = 0; | 66   int load_count_ = 0; | 
| 67   mojo::Binding<mojom::ViewClient> binding_; | 67   mojo::Binding<mojom::ViewClient> binding_; | 
| 68   base::RunLoop* loop_ = nullptr; | 68   base::RunLoop* loop_ = nullptr; | 
| 69   std::unique_ptr<service_manager::Connection> window_manager_connection_; |  | 
| 70 | 69 | 
| 71   DISALLOW_COPY_AND_ASSIGN(NavigationTest); | 70   DISALLOW_COPY_AND_ASSIGN(NavigationTest); | 
| 72 }; | 71 }; | 
| 73 | 72 | 
| 74 // See crbug.com/619523 | 73 // See crbug.com/619523 | 
| 75 TEST_F(NavigationTest, DISABLED_Navigate) { | 74 TEST_F(NavigationTest, DISABLED_Navigate) { | 
| 76   mojom::ViewFactoryPtr view_factory; | 75   mojom::ViewFactoryPtr view_factory; | 
| 77   connector()->BindInterface("navigation", &view_factory); | 76   connector()->BindInterface("navigation", &view_factory); | 
| 78 | 77 | 
| 79   mojom::ViewPtr view; | 78   mojom::ViewPtr view; | 
| 80   view_factory->CreateView(GetViewClient(), MakeRequest(&view)); | 79   view_factory->CreateView(GetViewClient(), MakeRequest(&view)); | 
| 81   view->NavigateTo(GURL("about:blank")); | 80   view->NavigateTo(GURL("about:blank")); | 
| 82 | 81 | 
| 83   base::RunLoop loop; | 82   base::RunLoop loop; | 
| 84   QuitOnLoadingStateChange(&loop); | 83   QuitOnLoadingStateChange(&loop); | 
| 85   loop.Run(); | 84   loop.Run(); | 
| 86 } | 85 } | 
| 87 | 86 | 
| 88 }  // namespace navigation | 87 }  // namespace navigation | 
| OLD | NEW | 
|---|