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

Unified Diff: chrome/browser/sessions/session_restore_browsertest.cc

Issue 2798143004: Fix for URL opening code (Closed)
Patch Set: Fixed class name usage. Created 3 years, 6 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 | « chrome/browser/sessions/session_restore.cc ('k') | content/public/test/repeated_notification_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sessions/session_restore_browsertest.cc
diff --git a/chrome/browser/sessions/session_restore_browsertest.cc b/chrome/browser/sessions/session_restore_browsertest.cc
index db9b2bc784e1cb7ed035745fffd1cee480317f5b..ef42430a28cf78fa61b82e59c01698f9e417ea38 100644
--- a/chrome/browser/sessions/session_restore_browsertest.cc
+++ b/chrome/browser/sessions/session_restore_browsertest.cc
@@ -4,6 +4,7 @@
#include <stddef.h>
+#include <algorithm>
#include <set>
#include <vector>
@@ -211,6 +212,9 @@ class SessionRestoreTest : public InProcessBrowserTest {
GURL url3_;
const BrowserList* active_browser_list_;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SessionRestoreTest);
};
// Activates the smart restore behaviour and tracks the loading of tabs.
@@ -1622,3 +1626,48 @@ IN_PROC_BROWSER_TEST_F(SmartSessionRestoreTest, MAYBE_CorrectLoadingOrder) {
}
}
}
+
+namespace {
+
+const char kStartupURL[] = "http://example.com/";
+const char kSessionURL[] = "http://localhost/";
+
+} // namespace
+
+class SessionRestoreWithStartupURLTest : public SessionRestoreTest {
+ public:
+ SessionRestoreWithStartupURLTest() {}
+
+ protected:
+ void SetUpCommandLine(base::CommandLine* command_line) override {
+ // Add startup URL to command line, but only in main test body in order
+ // to prevent that URL from beng opened twice.
+ if (!base::StartsWith(
+ testing::UnitTest::GetInstance()->current_test_info()->name(),
+ "PRE_", base::CompareCase::SENSITIVE)) {
+ command_line->AppendArg(kStartupURL);
+ }
+ SessionRestoreTest::SetUpCommandLine(command_line);
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SessionRestoreWithStartupURLTest);
+};
+
+IN_PROC_BROWSER_TEST_F(SessionRestoreWithStartupURLTest,
+ PRE_StartupURLsWithSessionRestore) {
+ // Prepare a session to restore in main test body.
+ ui_test_utils::NavigateToURL(browser(), GURL(kSessionURL));
+}
+
+IN_PROC_BROWSER_TEST_F(SessionRestoreWithStartupURLTest,
+ StartupURLsWithSessionRestore) {
+ // Check that browser is started with restored session and
+ // tab with startup URL next to it.
+ TabStripModel* tab_strip = browser()->tab_strip_model();
+ ASSERT_EQ(2, tab_strip->count());
+ EXPECT_EQ(kSessionURL,
+ tab_strip->GetWebContentsAt(0)->GetURL().possibly_invalid_spec());
+ EXPECT_EQ(kStartupURL,
+ tab_strip->GetWebContentsAt(1)->GetURL().possibly_invalid_spec());
+}
« no previous file with comments | « chrome/browser/sessions/session_restore.cc ('k') | content/public/test/repeated_notification_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698