blob: 89804bd2859fe6602f7a21c76f5bee0f8b4b1462 [file] [log] [blame]
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/signin/signin_promo.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
namespace signin {
TEST(SigninPromoTest, TestForceSigninURL) {
GURL expected_url_1(
"chrome://chrome-signin/?access_point=0&reason=0&auto_close=1");
EXPECT_EQ(expected_url_1,
GetEmbeddedPromoURL(
signin_metrics::AccessPoint::ACCESS_POINT_START_PAGE,
signin_metrics::Reason::REASON_SIGNIN_PRIMARY_ACCOUNT, true));
GURL expected_url_2("chrome://chrome-signin/?access_point=15&reason=3");
EXPECT_EQ(expected_url_2,
GetEmbeddedPromoURL(
signin_metrics::AccessPoint::ACCESS_POINT_SIGNIN_PROMO,
signin_metrics::Reason::REASON_UNLOCK, false));
}
TEST(SigninPromoTest, TestReauthURL) {
GURL expected_url_1(
"chrome://chrome-signin/"
"?access_point=0&reason=3&auto_close=1&email=example%40domain.com"
"&validateEmail=1&readOnlyEmail=1");
EXPECT_EQ(expected_url_1,
GetEmbeddedReauthURLWithEmail(
signin_metrics::AccessPoint::ACCESS_POINT_START_PAGE,
signin_metrics::Reason::REASON_UNLOCK, "example@domain.com"));
}
TEST(SigninPromoTest, TestLandingURL) {
GURL expected_url_1(
"chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik/"
"success.html?access_point=1&source=13");
EXPECT_EQ(expected_url_1,
GetLandingURL(signin_metrics::AccessPoint::ACCESS_POINT_NTP_LINK));
GURL expected_url_2(
"chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik/"
"success.html?access_point=0&source=0");
EXPECT_EQ(
expected_url_2,
GetLandingURL(signin_metrics::AccessPoint::ACCESS_POINT_START_PAGE));
GURL expected_url_3(
"chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik/"
"success.html?access_point=3&source=3");
EXPECT_EQ(expected_url_3,
GetLandingURL(signin_metrics::AccessPoint::ACCESS_POINT_SETTINGS));
}
} // namespace signin