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

Unified Diff: chrome/browser/prefetch/prefetch_browsertest.cc

Issue 148983006: Fix a crash due to uninitialized preference member in ProfileIOData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed a comment typo Created 6 years, 10 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 | chrome/browser/profiles/profile_io_data.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prefetch/prefetch_browsertest.cc
diff --git a/chrome/browser/prefetch/prefetch_browsertest.cc b/chrome/browser/prefetch/prefetch_browsertest.cc
index 1fe4f3b9331dbff6bb6b519780b747da7a9539e6..a870be6ffe72a269d4fb5bddb755f2206f67826c 100644
--- a/chrome/browser/prefetch/prefetch_browsertest.cc
+++ b/chrome/browser/prefetch/prefetch_browsertest.cc
@@ -42,7 +42,7 @@ class PrefetchBrowserTestBase : public InProcessBrowserTest {
prefs::kNetworkPredictionEnabled, do_predictive_networking_);
}
- bool RunPrefetchExperiment(bool expect_success) {
+ bool RunPrefetchExperiment(bool expect_success, Browser* browser) {
CHECK(test_server()->Start());
GURL url = test_server()->GetURL(kPrefetchPage);
@@ -50,9 +50,8 @@ class PrefetchBrowserTestBase : public InProcessBrowserTest {
expect_success ? base::ASCIIToUTF16("link onload")
: base::ASCIIToUTF16("link onerror");
content::TitleWatcher title_watcher(
- browser()->tab_strip_model()->GetActiveWebContents(), expected_title);
- ui_test_utils::NavigateToURL(browser(), url);
-
+ browser->tab_strip_model()->GetActiveWebContents(), expected_title);
+ ui_test_utils::NavigateToURL(browser, url);
return expected_title == title_watcher.WaitAndGetTitle();
}
@@ -87,22 +86,36 @@ class PrefetchBrowserTestPredictionOffExpOff : public PrefetchBrowserTestBase {
// Privacy option is on, experiment is on. Prefetch should succeed.
IN_PROC_BROWSER_TEST_F(PrefetchBrowserTestPredictionOnExpOn, PredOnExpOn) {
- EXPECT_TRUE(RunPrefetchExperiment(true));
+ EXPECT_TRUE(RunPrefetchExperiment(true, browser()));
}
// Privacy option is on, experiment is off. Prefetch should be dropped.
IN_PROC_BROWSER_TEST_F(PrefetchBrowserTestPredictionOnExpOff, PredOnExpOff) {
- EXPECT_TRUE(RunPrefetchExperiment(false));
+ EXPECT_TRUE(RunPrefetchExperiment(false, browser()));
}
// Privacy option is off, experiment is on. Prefetch should be dropped.
IN_PROC_BROWSER_TEST_F(PrefetchBrowserTestPredictionOffExpOn, PredOffExpOn) {
- EXPECT_TRUE(RunPrefetchExperiment(false));
+ EXPECT_TRUE(RunPrefetchExperiment(false, browser()));
}
// Privacy option is off, experiment is off. Prefetch should be dropped.
IN_PROC_BROWSER_TEST_F(PrefetchBrowserTestPredictionOffExpOff, PredOffExpOff) {
- EXPECT_TRUE(RunPrefetchExperiment(false));
+ EXPECT_TRUE(RunPrefetchExperiment(false, browser()));
+}
+
+// Bug 339909: When in incognito mode the browser crashed due to an
+// uninitialized preference member. Verify that it no longer does.
+IN_PROC_BROWSER_TEST_F(PrefetchBrowserTestPredictionOnExpOn, IncognitoTest) {
+ Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile();
+ Browser* incognito_browser = new Browser(
+ Browser::CreateParams(incognito_profile, browser()->host_desktop_type()));
+
+ // Navigate just to have a tab in this window, otherwise there is no
+ // WebContents for the incognito browser.
+ ui_test_utils::OpenURLOffTheRecord(browser()->profile(), GURL("about:blank"));
+
+ EXPECT_TRUE(RunPrefetchExperiment(true, incognito_browser));
}
} // namespace
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_io_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698