| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "base/memory/ptr_util.h" | 5 #include "base/memory/ptr_util.h" |
| 6 #include "blimp/client/core/contents/blimp_navigation_controller_impl.h" | 6 #include "blimp/client/core/contents/blimp_navigation_controller_impl.h" |
| 7 #include "blimp/client/core/context/blimp_client_context_impl.h" | 7 #include "blimp/client/core/context/blimp_client_context_impl.h" |
| 8 #include "blimp/client/session/test_client_session.h" | 8 #include "blimp/client/session/test_client_session.h" |
| 9 #include "blimp/client/test/compositor/mock_compositor_dependencies.h" | 9 #include "blimp/client/test/compositor/mock_compositor_dependencies.h" |
| 10 #include "blimp/client/test/contents/mock_blimp_contents_observer.h" | 10 #include "blimp/client/test/contents/mock_blimp_contents_observer.h" |
| 11 #include "blimp/client/test/test_blimp_client_context_delegate.h" | 11 #include "blimp/client/test/test_blimp_client_context_delegate.h" |
| 12 #include "blimp/engine/browser_tests/blimp_browser_test.h" | 12 #include "blimp/engine/browser_tests/blimp_browser_test.h" |
| 13 #include "components/prefs/testing_pref_service.h" |
| 13 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 14 #include "content/public/test/browser_test.h" | 15 #include "content/public/test/browser_test.h" |
| 15 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 17 #include "url/gurl.h" | 18 #include "url/gurl.h" |
| 18 | 19 |
| 19 using ::testing::_; | 20 using ::testing::_; |
| 20 using ::testing::AtLeast; | 21 using ::testing::AtLeast; |
| 21 using ::testing::InvokeWithoutArgs; | 22 using ::testing::InvokeWithoutArgs; |
| 22 | 23 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 33 // NavigationController, as well as network interaction between client and | 34 // NavigationController, as well as network interaction between client and |
| 34 // engine. | 35 // engine. |
| 35 class NavigationBrowserTest : public BlimpBrowserTest { | 36 class NavigationBrowserTest : public BlimpBrowserTest { |
| 36 public: | 37 public: |
| 37 NavigationBrowserTest() {} | 38 NavigationBrowserTest() {} |
| 38 | 39 |
| 39 protected: | 40 protected: |
| 40 void SetUpOnMainThread() override { | 41 void SetUpOnMainThread() override { |
| 41 BlimpBrowserTest::SetUpOnMainThread(); | 42 BlimpBrowserTest::SetUpOnMainThread(); |
| 42 | 43 |
| 44 client::BlimpClientContext::RegisterPrefs(prefs_.registry()); |
| 45 |
| 43 context_ = base::WrapUnique<client::BlimpClientContext>( | 46 context_ = base::WrapUnique<client::BlimpClientContext>( |
| 44 client::BlimpClientContext::Create( | 47 client::BlimpClientContext::Create( |
| 45 content::BrowserThread::GetTaskRunnerForThread( | 48 content::BrowserThread::GetTaskRunnerForThread( |
| 46 content::BrowserThread::IO), | 49 content::BrowserThread::IO), |
| 47 content::BrowserThread::GetTaskRunnerForThread( | 50 content::BrowserThread::GetTaskRunnerForThread( |
| 48 content::BrowserThread::FILE), | 51 content::BrowserThread::FILE), |
| 49 base::MakeUnique<client::MockCompositorDependencies>())); | 52 base::MakeUnique<client::MockCompositorDependencies>(), &prefs_)); |
| 50 | 53 |
| 51 delegate_ = base::MakeUnique<client::TestBlimpClientContextDelegate>(); | 54 delegate_ = base::MakeUnique<client::TestBlimpClientContextDelegate>(); |
| 52 context_->SetDelegate(delegate_.get()); | 55 context_->SetDelegate(delegate_.get()); |
| 53 context_->ConnectWithAssignment(GetAssignment()); | 56 context_->ConnectWithAssignment(GetAssignment()); |
| 54 contents_ = context_->CreateBlimpContents(nullptr); | 57 contents_ = context_->CreateBlimpContents(nullptr); |
| 55 | 58 |
| 56 EXPECT_TRUE(embedded_test_server()->Start()); | 59 EXPECT_TRUE(embedded_test_server()->Start()); |
| 57 } | 60 } |
| 58 | 61 |
| 59 void TearDownOnMainThread() override { | 62 void TearDownOnMainThread() override { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 // Gets the current page title from the client. | 102 // Gets the current page title from the client. |
| 100 const std::string& GetTitle() { | 103 const std::string& GetTitle() { |
| 101 return contents_->GetNavigationController().GetTitle(); | 104 return contents_->GetNavigationController().GetTitle(); |
| 102 } | 105 } |
| 103 | 106 |
| 104 std::unique_ptr<client::BlimpClientContextDelegate> delegate_; | 107 std::unique_ptr<client::BlimpClientContextDelegate> delegate_; |
| 105 std::unique_ptr<client::BlimpClientContext> context_; | 108 std::unique_ptr<client::BlimpClientContext> context_; |
| 106 std::unique_ptr<client::BlimpContents> contents_; | 109 std::unique_ptr<client::BlimpContents> contents_; |
| 107 | 110 |
| 108 private: | 111 private: |
| 112 TestingPrefServiceSimple prefs_; |
| 109 DISALLOW_COPY_AND_ASSIGN(NavigationBrowserTest); | 113 DISALLOW_COPY_AND_ASSIGN(NavigationBrowserTest); |
| 110 }; | 114 }; |
| 111 | 115 |
| 112 IN_PROC_BROWSER_TEST_F(NavigationBrowserTest, LoadUrl) { | 116 IN_PROC_BROWSER_TEST_F(NavigationBrowserTest, LoadUrl) { |
| 113 LoadPage(kPage1Path); | 117 LoadPage(kPage1Path); |
| 114 EXPECT_EQ(kPage1Title, GetTitle()); | 118 EXPECT_EQ(kPage1Title, GetTitle()); |
| 115 } | 119 } |
| 116 | 120 |
| 117 IN_PROC_BROWSER_TEST_F(NavigationBrowserTest, Reload) { | 121 IN_PROC_BROWSER_TEST_F(NavigationBrowserTest, Reload) { |
| 118 LoadPage(kPage1Path); | 122 LoadPage(kPage1Path); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 ExpectPageLoad(&observer); | 179 ExpectPageLoad(&observer); |
| 176 contents_->GetNavigationController().GoForward(); | 180 contents_->GetNavigationController().GoForward(); |
| 177 NavigateToLocalUrl(kPage2Path); | 181 NavigateToLocalUrl(kPage2Path); |
| 178 RunUntilCompletion(); | 182 RunUntilCompletion(); |
| 179 } | 183 } |
| 180 EXPECT_EQ(kPage2Title, GetTitle()); | 184 EXPECT_EQ(kPage2Title, GetTitle()); |
| 181 } | 185 } |
| 182 | 186 |
| 183 } // namespace | 187 } // namespace |
| 184 } // namespace blimp | 188 } // namespace blimp |
| OLD | NEW |