#include "chrome/browser/enterprise/profile_management/profile_management_navigation_throttle.h"
#include "base/base64.h"
#include "base/run_loop.h"
#include "base/strings/strcat.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/enterprise/profile_management/profile_management_features.h"
#include "chrome/browser/enterprise/profile_management/saml_response_parser.h"
#include "chrome/browser/profiles/profiles_state.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/browser_with_test_window_test.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/mock_navigation_handle.h"
#include "services/data_decoder/public/cpp/test_support/in_process_data_decoder.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace profile_management {
_;
namespace {
constexpr char kSupportedDomain[] = …;
constexpr char kSwitchDomain[] = …;
constexpr char kGoogleServiceLoginUrl[] = …;
constexpr char kTokenUrl[] = …;
constexpr char kUnmanagedUrl[] = …;
constexpr char kTestUrl[] = …;
constexpr char kValidDomain[] = …;
constexpr char kInvalidDomain[] = …;
constexpr char kValidEmail[] = …;
constexpr char kInvalidEmail[] = …;
constexpr char kJSONAttributesTemplate[] = …;
constexpr char kHTMLTemplate[] = …;
constexpr char kSAMLResponse[] = …;
std::string BuildSAMLResponse(const std::string& domain,
const std::string& token = "token-value") { … }
}
class ProfileManagementNavigationThrottleTest
: public BrowserWithTestWindowTest { … };
TEST_F(ProfileManagementNavigationThrottleTest, FeaturesDisabled) { … }
TEST_F(ProfileManagementNavigationThrottleTest, ProfileCreationDisallowed) { … }
TEST_F(ProfileManagementNavigationThrottleTest, UnsupportedHost) { … }
TEST_F(ProfileManagementNavigationThrottleTest, Switch_InvalidJSON) { … }
TEST_F(ProfileManagementNavigationThrottleTest, Switch_InvalidAttributes) { … }
class ProfileManagementNavigationThrottleRedirectTest
: public ProfileManagementNavigationThrottleTest { … };
TEST_F(ProfileManagementNavigationThrottleRedirectTest, InvalidEmail) { … }
TEST_F(ProfileManagementNavigationThrottleRedirectTest, ValidEmail) { … }
TEST_F(ProfileManagementNavigationThrottleRedirectTest, EmptyDomain) { … }
TEST_F(ProfileManagementNavigationThrottleRedirectTest, EmptyDomainAndToken) { … }
TEST_F(ProfileManagementNavigationThrottleRedirectTest, InvalidDomain) { … }
TEST_F(ProfileManagementNavigationThrottleRedirectTest, ValidDomain) { … }
TEST_F(ProfileManagementNavigationThrottleRedirectTest, Switch_ValidDomain) { … }
}