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

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

Issue 2295543002: More Blimp browser tests for navigation (Closed)
Patch Set: unused Created 4 years, 3 months 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 | « no previous file | blimp/engine/session/tab.cc » ('j') | blimp/engine/session/tab.cc » ('J')
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/core/contents/ime_feature.h" 6 #include "blimp/client/core/contents/ime_feature.h"
7 #include "blimp/client/core/contents/mock_ime_feature_delegate.h" 7 #include "blimp/client/core/contents/mock_ime_feature_delegate.h"
8 #include "blimp/client/core/contents/mock_navigation_feature_delegate.h" 8 #include "blimp/client/core/contents/mock_navigation_feature_delegate.h"
9 #include "blimp/client/core/contents/navigation_feature.h" 9 #include "blimp/client/core/contents/navigation_feature.h"
10 #include "blimp/client/core/contents/tab_control_feature.h" 10 #include "blimp/client/core/contents/tab_control_feature.h"
(...skipping 10 matching lines...) Expand all
21 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
22 #include "ui/gfx/geometry/size.h" 22 #include "ui/gfx/geometry/size.h"
23 #include "url/gurl.h" 23 #include "url/gurl.h"
24 24
25 using ::testing::InvokeWithoutArgs; 25 using ::testing::InvokeWithoutArgs;
26 26
27 namespace blimp { 27 namespace blimp {
28 namespace { 28 namespace {
29 29
30 const int kDummyTabId = 0; 30 const int kDummyTabId = 0;
31 const char kPage1Path[] = "/page1.html";
32 const char kPage2Path[] = "/page2.html";
33 const char kPage1Title[] = "page1";
34 const char kPage2Title[] = "page2";
31 35
32 // Uses a headless client session to test a full engine. 36 // Uses a headless client session to test a full engine.
33 class EngineBrowserTest : public BlimpBrowserTest { 37 class EngineBrowserTest : public BlimpBrowserTest {
34 public: 38 public:
35 EngineBrowserTest() {} 39 EngineBrowserTest() {}
36 40
37 protected: 41 protected:
38 void SetUpOnMainThread() override { 42 void SetUpOnMainThread() override {
39 BlimpBrowserTest::SetUpOnMainThread(); 43 BlimpBrowserTest::SetUpOnMainThread();
40 44
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 std::unique_ptr<client::TestClientSession> client_session_; 107 std::unique_ptr<client::TestClientSession> client_session_;
104 std::string last_page_title_; 108 std::string last_page_title_;
105 109
106 private: 110 private:
107 DISALLOW_COPY_AND_ASSIGN(EngineBrowserTest); 111 DISALLOW_COPY_AND_ASSIGN(EngineBrowserTest);
108 }; 112 };
109 113
110 IN_PROC_BROWSER_TEST_F(EngineBrowserTest, LoadUrl) { 114 IN_PROC_BROWSER_TEST_F(EngineBrowserTest, LoadUrl) {
111 EXPECT_CALL(client_rw_feature_delegate_, OnRenderWidgetCreated(1)); 115 EXPECT_CALL(client_rw_feature_delegate_, OnRenderWidgetCreated(1));
112 ExpectPageLoad(); 116 ExpectPageLoad();
113 NavigateToLocalUrl("/page1.html"); 117 NavigateToLocalUrl(kPage1Path);
114 RunAndVerify(); 118 RunAndVerify();
115 EXPECT_EQ("page1", last_page_title_); 119 EXPECT_EQ(kPage1Title, last_page_title_);
116 } 120 }
117 121
118 IN_PROC_BROWSER_TEST_F(EngineBrowserTest, GoBack) { 122 IN_PROC_BROWSER_TEST_F(EngineBrowserTest, Reload) {
119 ExpectPageLoad(); 123 ExpectPageLoad();
120 NavigateToLocalUrl("/page1.html"); 124 NavigateToLocalUrl(kPage1Path);
121 RunAndVerify(); 125 RunAndVerify();
122 EXPECT_EQ("page1", last_page_title_); 126 EXPECT_EQ(kPage1Title, last_page_title_);
123 127
124 ExpectPageLoad(); 128 ExpectPageLoad();
125 NavigateToLocalUrl("/page2.html"); 129 client_session_->GetNavigationFeature()->Reload(kDummyTabId);
126 RunAndVerify(); 130 RunAndVerify();
127 EXPECT_EQ("page2", last_page_title_); 131 EXPECT_EQ(kPage1Title, last_page_title_);
132 }
133
134 IN_PROC_BROWSER_TEST_F(EngineBrowserTest, GoBackAndGoForward) {
135 ExpectPageLoad();
136 NavigateToLocalUrl(kPage1Path);
137 RunAndVerify();
138 EXPECT_EQ(kPage1Title, last_page_title_);
139
140 ExpectPageLoad();
141 NavigateToLocalUrl(kPage2Path);
142 RunAndVerify();
143 EXPECT_EQ(kPage2Title, last_page_title_);
128 144
129 ExpectPageLoad(); 145 ExpectPageLoad();
130 client_session_->GetNavigationFeature()->GoBack(kDummyTabId); 146 client_session_->GetNavigationFeature()->GoBack(kDummyTabId);
131 RunAndVerify(); 147 RunAndVerify();
132 EXPECT_EQ("page1", last_page_title_); 148 EXPECT_EQ(kPage1Title, last_page_title_);
149
150 ExpectPageLoad();
151 client_session_->GetNavigationFeature()->GoForward(kDummyTabId);
152 RunAndVerify();
153 EXPECT_EQ(kPage2Title, last_page_title_);
154 }
155
156 IN_PROC_BROWSER_TEST_F(EngineBrowserTest, InvalidGoBack) {
157 // Try an invalid GoBack before loading a page, and assert that the page still
158 // loads correctly.
159 ExpectPageLoad();
160 client_session_->GetNavigationFeature()->GoBack(kDummyTabId);
161 NavigateToLocalUrl(kPage1Path);
162 RunAndVerify();
163 EXPECT_EQ(kPage1Title, last_page_title_);
164 }
165
166 IN_PROC_BROWSER_TEST_F(EngineBrowserTest, InvalidGoForward) {
167 ExpectPageLoad();
168 NavigateToLocalUrl(kPage1Path);
169 RunAndVerify();
170 EXPECT_EQ(kPage1Title, last_page_title_);
171
172 // Try an invalid GoForward before loading a different page, and
173 // assert that the page still loads correctly.
174 ExpectPageLoad();
175 client_session_->GetNavigationFeature()->GoForward(kDummyTabId);
176 NavigateToLocalUrl(kPage2Path);
177 RunAndVerify();
178 EXPECT_EQ(kPage2Title, last_page_title_);
133 } 179 }
134 180
135 } // namespace 181 } // namespace
136 } // namespace blimp 182 } // namespace blimp
OLDNEW
« no previous file with comments | « no previous file | blimp/engine/session/tab.cc » ('j') | blimp/engine/session/tab.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698