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

Unified Diff: blimp/engine/browser_tests/engine_browsertest.cc

Issue 2295543002: More Blimp browser tests for navigation (Closed)
Patch Set: review changes Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | blimp/engine/session/tab.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/engine/browser_tests/engine_browsertest.cc
diff --git a/blimp/engine/browser_tests/engine_browsertest.cc b/blimp/engine/browser_tests/engine_browsertest.cc
index ac9cec97707e9c9328a22084310b0930f0efe2ac..0a132d110cff23c6c8a8ab3ff99dace1ff7a6bd9 100644
--- a/blimp/engine/browser_tests/engine_browsertest.cc
+++ b/blimp/engine/browser_tests/engine_browsertest.cc
@@ -28,6 +28,10 @@ namespace blimp {
namespace {
const int kDummyTabId = 0;
+const char kPage1Path[] = "/page1.html";
+const char kPage2Path[] = "/page2.html";
+const char kPage1Title[] = "page1";
+const char kPage2Title[] = "page2";
// Uses a headless client session to test a full engine.
class EngineBrowserTest : public BlimpBrowserTest {
@@ -91,6 +95,13 @@ class EngineBrowserTest : public BlimpBrowserTest {
InvokeWithoutArgs(this, &EngineBrowserTest::SignalCompletion));
}
+ // Expect that the page load status won't change.
+ void ExpectNoPageLoad() {
Kevin M 2016/08/30 00:52:39 Never called?
Brian Goldman 2016/08/30 01:01:32 Oh whoops, this was a helper than turned out to be
+ EXPECT_CALL(client_nav_feature_delegate_,
+ OnLoadingChanged(kDummyTabId, testing::_))
+ .Times(0);
+ }
+
void RunAndVerify() {
RunUntilCompletion();
testing::Mock::VerifyAndClearExpectations(&client_rw_feature_delegate_);
@@ -110,26 +121,68 @@ class EngineBrowserTest : public BlimpBrowserTest {
IN_PROC_BROWSER_TEST_F(EngineBrowserTest, LoadUrl) {
EXPECT_CALL(client_rw_feature_delegate_, OnRenderWidgetCreated(1));
ExpectPageLoad();
- NavigateToLocalUrl("/page1.html");
+ NavigateToLocalUrl(kPage1Path);
RunAndVerify();
- EXPECT_EQ("page1", last_page_title_);
+ EXPECT_EQ(kPage1Title, last_page_title_);
}
-IN_PROC_BROWSER_TEST_F(EngineBrowserTest, GoBack) {
+IN_PROC_BROWSER_TEST_F(EngineBrowserTest, Reload) {
ExpectPageLoad();
- NavigateToLocalUrl("/page1.html");
+ NavigateToLocalUrl(kPage1Path);
RunAndVerify();
- EXPECT_EQ("page1", last_page_title_);
+ EXPECT_EQ(kPage1Title, last_page_title_);
+
+ ExpectPageLoad();
+ client_session_->GetNavigationFeature()->Reload(kDummyTabId);
+ RunAndVerify();
+ EXPECT_EQ(kPage1Title, last_page_title_);
+}
+IN_PROC_BROWSER_TEST_F(EngineBrowserTest, GoBackAndGoForward) {
ExpectPageLoad();
- NavigateToLocalUrl("/page2.html");
+ NavigateToLocalUrl(kPage1Path);
RunAndVerify();
- EXPECT_EQ("page2", last_page_title_);
+ EXPECT_EQ(kPage1Title, last_page_title_);
+
+ ExpectPageLoad();
+ NavigateToLocalUrl(kPage2Path);
+ RunAndVerify();
+ EXPECT_EQ(kPage2Title, last_page_title_);
ExpectPageLoad();
client_session_->GetNavigationFeature()->GoBack(kDummyTabId);
RunAndVerify();
- EXPECT_EQ("page1", last_page_title_);
+ EXPECT_EQ(kPage1Title, last_page_title_);
+
+ ExpectPageLoad();
+ client_session_->GetNavigationFeature()->GoForward(kDummyTabId);
+ RunAndVerify();
+ EXPECT_EQ(kPage2Title, last_page_title_);
+}
+
+IN_PROC_BROWSER_TEST_F(EngineBrowserTest, InvalidGoBack) {
+ // Try an invalid GoBack before loading a page, and assert that the page still
+ // loads correctly.
+ ExpectPageLoad();
+ client_session_->GetNavigationFeature()->GoBack(kDummyTabId);
+ NavigateToLocalUrl(kPage1Path);
+ RunAndVerify();
+ EXPECT_EQ(kPage1Title, last_page_title_);
+}
+
+IN_PROC_BROWSER_TEST_F(EngineBrowserTest, InvalidGoForward) {
+ ExpectPageLoad();
+ NavigateToLocalUrl(kPage1Path);
+ RunAndVerify();
+ EXPECT_EQ(kPage1Title, last_page_title_);
+
+ // Try an invalid GoForward before loading a different page, and
+ // assert that the page still loads correctly.
+ ExpectPageLoad();
+ client_session_->GetNavigationFeature()->GoForward(kDummyTabId);
+ NavigateToLocalUrl(kPage2Path);
+ RunAndVerify();
+ EXPECT_EQ(kPage2Title, last_page_title_);
}
} // namespace
« no previous file with comments | « no previous file | blimp/engine/session/tab.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698