Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Side by Side Diff: blimp/engine/browser_tests/navigation_browsertest.cc

Issue 2349073002: Blimp Settings framework on the c++ side (Closed)
Patch Set: nits and sync to head Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « blimp/engine/browser_tests/integration_test.cc ('k') | chrome/browser/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/app/session/test_client_session.h" 6 #include "blimp/client/app/session/test_client_session.h"
7 #include "blimp/client/public/blimp_client_context.h" 7 #include "blimp/client/public/blimp_client_context.h"
8 #include "blimp/client/public/contents/blimp_contents.h" 8 #include "blimp/client/public/contents/blimp_contents.h"
9 #include "blimp/client/public/contents/blimp_navigation_controller.h" 9 #include "blimp/client/public/contents/blimp_navigation_controller.h"
10 #include "blimp/client/test/compositor/mock_compositor_dependencies.h" 10 #include "blimp/client/test/compositor/mock_compositor_dependencies.h"
11 #include "blimp/client/test/contents/mock_blimp_contents_observer.h" 11 #include "blimp/client/test/contents/mock_blimp_contents_observer.h"
12 #include "blimp/client/test/test_blimp_client_context_delegate.h" 12 #include "blimp/client/test/test_blimp_client_context_delegate.h"
13 #include "blimp/engine/browser_tests/blimp_browser_test.h" 13 #include "blimp/engine/browser_tests/blimp_browser_test.h"
14 #include "components/prefs/testing_pref_service.h"
14 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
15 #include "content/public/test/browser_test.h" 16 #include "content/public/test/browser_test.h"
16 #include "testing/gmock/include/gmock/gmock.h" 17 #include "testing/gmock/include/gmock/gmock.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 #include "url/gurl.h" 19 #include "url/gurl.h"
19 20
20 using ::testing::_; 21 using ::testing::_;
21 using ::testing::AtLeast; 22 using ::testing::AtLeast;
22 using ::testing::InvokeWithoutArgs; 23 using ::testing::InvokeWithoutArgs;
23 24
(...skipping 10 matching lines...) Expand all
34 // NavigationController, as well as network interaction between client and 35 // NavigationController, as well as network interaction between client and
35 // engine. 36 // engine.
36 class NavigationBrowserTest : public BlimpBrowserTest { 37 class NavigationBrowserTest : public BlimpBrowserTest {
37 public: 38 public:
38 NavigationBrowserTest() {} 39 NavigationBrowserTest() {}
39 40
40 protected: 41 protected:
41 void SetUpOnMainThread() override { 42 void SetUpOnMainThread() override {
42 BlimpBrowserTest::SetUpOnMainThread(); 43 BlimpBrowserTest::SetUpOnMainThread();
43 44
45 client::BlimpClientContext::RegisterPrefs(prefs_.registry());
46
44 context_ = base::WrapUnique<client::BlimpClientContext>( 47 context_ = base::WrapUnique<client::BlimpClientContext>(
45 client::BlimpClientContext::Create( 48 client::BlimpClientContext::Create(
46 content::BrowserThread::GetTaskRunnerForThread( 49 content::BrowserThread::GetTaskRunnerForThread(
47 content::BrowserThread::IO), 50 content::BrowserThread::IO),
48 content::BrowserThread::GetTaskRunnerForThread( 51 content::BrowserThread::GetTaskRunnerForThread(
49 content::BrowserThread::FILE), 52 content::BrowserThread::FILE),
50 base::MakeUnique<client::MockCompositorDependencies>())); 53 base::MakeUnique<client::MockCompositorDependencies>(), &prefs_));
51 54
52 delegate_ = base::MakeUnique<client::TestBlimpClientContextDelegate>(); 55 delegate_ = base::MakeUnique<client::TestBlimpClientContextDelegate>();
53 context_->SetDelegate(delegate_.get()); 56 context_->SetDelegate(delegate_.get());
54 context_->ConnectWithAssignment(GetAssignment()); 57 context_->ConnectWithAssignment(GetAssignment());
55 contents_ = context_->CreateBlimpContents(nullptr); 58 contents_ = context_->CreateBlimpContents(nullptr);
56 59
57 EXPECT_TRUE(embedded_test_server()->Start()); 60 EXPECT_TRUE(embedded_test_server()->Start());
58 } 61 }
59 62
60 void TearDownOnMainThread() override { 63 void TearDownOnMainThread() override {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 // Gets the current page title from the client. 103 // Gets the current page title from the client.
101 const std::string& GetTitle() { 104 const std::string& GetTitle() {
102 return contents_->GetNavigationController().GetTitle(); 105 return contents_->GetNavigationController().GetTitle();
103 } 106 }
104 107
105 std::unique_ptr<client::BlimpClientContextDelegate> delegate_; 108 std::unique_ptr<client::BlimpClientContextDelegate> delegate_;
106 std::unique_ptr<client::BlimpClientContext> context_; 109 std::unique_ptr<client::BlimpClientContext> context_;
107 std::unique_ptr<client::BlimpContents> contents_; 110 std::unique_ptr<client::BlimpContents> contents_;
108 111
109 private: 112 private:
113 TestingPrefServiceSimple prefs_;
110 DISALLOW_COPY_AND_ASSIGN(NavigationBrowserTest); 114 DISALLOW_COPY_AND_ASSIGN(NavigationBrowserTest);
111 }; 115 };
112 116
113 IN_PROC_BROWSER_TEST_F(NavigationBrowserTest, LoadUrl) { 117 IN_PROC_BROWSER_TEST_F(NavigationBrowserTest, LoadUrl) {
114 LoadPage(kPage1Path); 118 LoadPage(kPage1Path);
115 EXPECT_EQ(kPage1Title, GetTitle()); 119 EXPECT_EQ(kPage1Title, GetTitle());
116 } 120 }
117 121
118 IN_PROC_BROWSER_TEST_F(NavigationBrowserTest, Reload) { 122 IN_PROC_BROWSER_TEST_F(NavigationBrowserTest, Reload) {
119 LoadPage(kPage1Path); 123 LoadPage(kPage1Path);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 ExpectPageLoad(&observer); 180 ExpectPageLoad(&observer);
177 contents_->GetNavigationController().GoForward(); 181 contents_->GetNavigationController().GoForward();
178 NavigateToLocalUrl(kPage2Path); 182 NavigateToLocalUrl(kPage2Path);
179 RunUntilCompletion(); 183 RunUntilCompletion();
180 } 184 }
181 EXPECT_EQ(kPage2Title, GetTitle()); 185 EXPECT_EQ(kPage2Title, GetTitle());
182 } 186 }
183 187
184 } // namespace 188 } // namespace
185 } // namespace blimp 189 } // namespace blimp
OLDNEW
« no previous file with comments | « blimp/engine/browser_tests/integration_test.cc ('k') | chrome/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698