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

Side by Side Diff: chrome/browser/prerender/prerender_browsertest.cc

Issue 2458953002: Fix PrerenderBrowserTest.AutosigninInPrerenderer flakiness. (Closed)
Patch Set: TODO 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <stddef.h> 5 #include <stddef.h>
6 #include <deque> 6 #include <deque>
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <unordered_map> 9 #include <unordered_map>
10 #include <utility> 10 #include <utility>
(...skipping 3199 matching lines...) Expand 10 before | Expand all | Expand 10 after
3210 EXPECT_TRUE(ExecuteScriptAndExtractString( 3210 EXPECT_TRUE(ExecuteScriptAndExtractString(
3211 web_contents, 3211 web_contents,
3212 "window.domAutomationController.send(" 3212 "window.domAutomationController.send("
3213 "document.getElementsByTagName('pre')[0].innerText);", 3213 "document.getElementsByTagName('pre')[0].innerText);",
3214 &body)); 3214 &body));
3215 EXPECT_EQ("text=value\n", body); 3215 EXPECT_EQ("text=value\n", body);
3216 } 3216 }
3217 3217
3218 // Prerenders a page that tries to automatically sign user in via the Credential 3218 // Prerenders a page that tries to automatically sign user in via the Credential
3219 // Manager API. The page should be killed. 3219 // Manager API. The page should be killed.
3220 // 3220 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, AutosigninInPrerenderer) {
3221 // Disabled. See http://crbug.com/660278
3222 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, DISABLED_AutosigninInPrerenderer) {
3223 // Set up a credential in the password store. 3221 // Set up a credential in the password store.
3224 PasswordStoreFactory::GetInstance()->SetTestingFactory( 3222 PasswordStoreFactory::GetInstance()->SetTestingFactory(
3225 current_browser()->profile(), 3223 current_browser()->profile(),
3226 password_manager::BuildPasswordStore< 3224 password_manager::BuildPasswordStore<
3227 content::BrowserContext, password_manager::TestPasswordStore>); 3225 content::BrowserContext, password_manager::TestPasswordStore>);
3228 scoped_refptr<password_manager::TestPasswordStore> password_store = 3226 scoped_refptr<password_manager::TestPasswordStore> password_store =
3229 static_cast<password_manager::TestPasswordStore*>( 3227 static_cast<password_manager::TestPasswordStore*>(
3230 PasswordStoreFactory::GetForProfile( 3228 PasswordStoreFactory::GetForProfile(
3231 current_browser()->profile(), 3229 current_browser()->profile(),
3232 ServiceAccessType::IMPLICIT_ACCESS).get()); 3230 ServiceAccessType::IMPLICIT_ACCESS).get());
(...skipping 11 matching lines...) Expand all
3244 // Intercept the successful landing page where a signed in user ends up. 3242 // Intercept the successful landing page where a signed in user ends up.
3245 // It should never load as the API is suppressed. 3243 // It should never load as the API is suppressed.
3246 GURL done_url = embedded_test_server()->GetURL("/password/done.html"); 3244 GURL done_url = embedded_test_server()->GetURL("/password/done.html");
3247 base::FilePath empty_file = ui_test_utils::GetTestFilePath( 3245 base::FilePath empty_file = ui_test_utils::GetTestFilePath(
3248 base::FilePath(), base::FilePath(FILE_PATH_LITERAL("empty.html"))); 3246 base::FilePath(), base::FilePath(FILE_PATH_LITERAL("empty.html")));
3249 RequestCounter done_counter; 3247 RequestCounter done_counter;
3250 BrowserThread::PostTask( 3248 BrowserThread::PostTask(
3251 BrowserThread::IO, FROM_HERE, 3249 BrowserThread::IO, FROM_HERE,
3252 base::Bind(&CreateCountingInterceptorOnIO, 3250 base::Bind(&CreateCountingInterceptorOnIO,
3253 done_url, empty_file, done_counter.AsWeakPtr())); 3251 done_url, empty_file, done_counter.AsWeakPtr()));
3252 // Loading may finish or be interrupted. The final result is important only.
3253 // TODO(http://crbug.com/660278): TestPrrenderContents can be created after
3254 // the JS code runs. The result would be a test timeout.
3255 DisableLoadEventCheck();
3254 PrerenderTestURL("/password/autosignin.html", 3256 PrerenderTestURL("/password/autosignin.html",
3255 FINAL_STATUS_CREDENTIAL_MANAGER_API, 0); 3257 FINAL_STATUS_CREDENTIAL_MANAGER_API, 0);
3256 EXPECT_EQ(0, done_counter.count()); 3258 EXPECT_EQ(0, done_counter.count());
3257 } 3259 }
3258 3260
3259 class PrerenderIncognitoBrowserTest : public PrerenderBrowserTest { 3261 class PrerenderIncognitoBrowserTest : public PrerenderBrowserTest {
3260 public: 3262 public:
3261 void SetUpOnMainThread() override { 3263 void SetUpOnMainThread() override {
3262 Profile* normal_profile = current_browser()->profile(); 3264 Profile* normal_profile = current_browser()->profile();
3263 set_browser(OpenURLOffTheRecord(normal_profile, GURL("about:blank"))); 3265 set_browser(OpenURLOffTheRecord(normal_profile, GURL("about:blank")));
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
3404 browser()->tab_strip_model()->GetActiveWebContents(); 3406 browser()->tab_strip_model()->GetActiveWebContents();
3405 bool display_test_result = false; 3407 bool display_test_result = false;
3406 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(web_contents, 3408 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(web_contents,
3407 "DidDisplayReallyPass()", 3409 "DidDisplayReallyPass()",
3408 &display_test_result)); 3410 &display_test_result));
3409 ASSERT_TRUE(display_test_result); 3411 ASSERT_TRUE(display_test_result);
3410 } 3412 }
3411 #endif // !defined(DISABLE_NACL) 3413 #endif // !defined(DISABLE_NACL)
3412 3414
3413 } // namespace prerender 3415 } // namespace prerender
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698