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

Unified Diff: chrome/browser/ui/sync/one_click_signin_helper_unittest.cc

Issue 22253010: Fix unwanted sign in to Chrome when the user signs in to another service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Back to patch 7 + style fix Created 7 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
Index: chrome/browser/ui/sync/one_click_signin_helper_unittest.cc
diff --git a/chrome/browser/ui/sync/one_click_signin_helper_unittest.cc b/chrome/browser/ui/sync/one_click_signin_helper_unittest.cc
index aebcbfacb907290ead303d5e9f18eb2fb874c404..1406217b1f9359ccda10cb303f52d3ab93c11d7a 100644
--- a/chrome/browser/ui/sync/one_click_signin_helper_unittest.cc
+++ b/chrome/browser/ui/sync/one_click_signin_helper_unittest.cc
@@ -28,7 +28,9 @@
#include "chrome/test/base/testing_profile.h"
#include "chrome/test/base/testing_profile_manager.h"
#include "content/public/browser/browser_context.h"
+#include "content/public/browser/navigation_details.h"
#include "content/public/browser/web_contents.h"
+#include "content/public/common/frame_navigate_params.h"
#include "content/public/common/password_form.h"
#include "content/public/common/url_constants.h"
#include "content/public/test/mock_render_process_host.h"
@@ -670,6 +672,27 @@ TEST_F(OneClickSigninHelperTest, SigninFromWebstoreWithConfigSyncfirst) {
EXPECT_EQ("user@gmail.com", signin_manager_->GetAuthenticatedUsername());
}
+// Checks that the state of OneClickSigninHelper is cleaned when there is a
+// navigation away from the sign in flow that is not triggered by the
+// web contents.
+TEST_F(OneClickSigninHelperTest, CleanTransientStateOnNavigate) {
+ content::WebContents* contents = web_contents();
+
+ OneClickSigninHelper::CreateForWebContents(contents);
+ OneClickSigninHelper* helper =
+ OneClickSigninHelper::FromWebContents(contents);
+ helper->SetDoNotClearPendingEmailForTesting();
+ helper->auto_accept_ = OneClickSigninHelper::AUTO_ACCEPT_EXPLICIT;
+
+ content::LoadCommittedDetails details;
+ content::FrameNavigateParams params;
+ params.url = GURL("http://crbug.com");
+ params.transition = content::PAGE_TRANSITION_TYPED;
+ helper->DidNavigateMainFrame(details, params);
+
+ EXPECT_EQ(OneClickSigninHelper::AUTO_ACCEPT_NONE, helper->auto_accept_);
+}
+
// I/O thread tests
TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThread) {

Powered by Google App Engine
This is Rietveld 408576698