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

Unified Diff: chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc

Issue 482293003: Remove webstore code for signin that is no longer used. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 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/extensions/api/webstore_private/webstore_private_apitest.cc
diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc b/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc
index ed403f883829904767f8ac04582291ea9c4622ea..9a5eeb69a26cfa6bc5b3d2ff08b047a73189a758 100644
--- a/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc
+++ b/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc
@@ -21,18 +21,11 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/webstore_installer.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
-#include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h"
-#include "chrome/browser/signin/fake_signin_manager.h"
-#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
-#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
-#include "components/signin/core/browser/signin_manager.h"
-#include "components/signin/core/browser/test_signin_client.h"
#include "content/public/browser/gpu_data_manager.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -103,9 +96,7 @@ class WebstoreInstallListener : public WebstoreInstaller::Delegate {
// A base class for tests below.
class ExtensionWebstorePrivateApiTest : public ExtensionApiTest {
public:
- ExtensionWebstorePrivateApiTest()
- : signin_manager_(NULL),
- token_service_(NULL) {}
+ ExtensionWebstorePrivateApiTest() {}
virtual ~ExtensionWebstorePrivateApiTest() {}
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
@@ -123,24 +114,6 @@ class ExtensionWebstorePrivateApiTest : public ExtensionApiTest {
host_resolver()->AddRule("www.example.com", "127.0.0.1");
ASSERT_TRUE(StartSpawnedTestServer());
ExtensionInstallUI::set_disable_failure_ui_for_tests();
-
- will_create_browser_context_services_subscription_ =
- BrowserContextDependencyManager::GetInstance()->
- RegisterWillCreateBrowserContextServicesCallbackForTesting(
- base::Bind(
- &ExtensionWebstorePrivateApiTest::
- OnWillCreateBrowserContextServices,
- base::Unretained(this))).Pass();
- }
-
- void OnWillCreateBrowserContextServices(content::BrowserContext* context) {
- // Replace the signin manager and token service with fakes. Do this ahead of
- // creating the browser so that a bunch of classes don't register as
- // observers and end up needing to unregister when the fake is substituted.
- SigninManagerFactory::GetInstance()->SetTestingFactory(
- context, &FakeSigninManagerBase::Build);
- ProfileOAuth2TokenServiceFactory::GetInstance()->SetTestingFactory(
- context, &BuildFakeProfileOAuth2TokenService);
}
virtual void SetUpOnMainThread() OVERRIDE {
@@ -149,17 +122,6 @@ class ExtensionWebstorePrivateApiTest : public ExtensionApiTest {
ExtensionInstallPrompt::g_auto_confirm_for_tests =
ExtensionInstallPrompt::ACCEPT;
- // Grab references to the fake signin manager and token service.
- signin_manager_ =
- static_cast<FakeSigninManagerForTesting*>(
- SigninManagerFactory::GetInstance()->GetForProfile(profile()));
- ASSERT_TRUE(signin_manager_);
- token_service_ =
- static_cast<FakeProfileOAuth2TokenService*>(
- ProfileOAuth2TokenServiceFactory::GetInstance()->GetForProfile(
- profile()));
- ASSERT_TRUE(token_service_);
-
ASSERT_TRUE(webstore_install_dir_.CreateUniqueTempDir());
webstore_install_dir_copy_ = webstore_install_dir_.path();
WebstoreInstaller::SetDownloadDirectoryForTests(
@@ -204,21 +166,6 @@ class ExtensionWebstorePrivateApiTest : public ExtensionApiTest {
#endif
}
- // Navigates to |page| and waits for the API call.
- void StartSignInTest(const std::string& page) {
- ui_test_utils::NavigateToURL(browser(), GetTestServerURL(page));
-
- // Wait for the API to be called. A simple way to wait for this is to run
- // some other JavaScript in the page and wait for a round-trip back to the
- // browser process.
- bool result = false;
- ASSERT_TRUE(
- content::ExecuteScriptAndExtractBool(
- GetWebContents(), "window.domAutomationController.send(true)",
- &result));
- ASSERT_TRUE(result);
- }
-
content::WebContents* GetWebContents() {
return browser()->tab_strip_model()->GetActiveWebContents();
}
@@ -227,13 +174,7 @@ class ExtensionWebstorePrivateApiTest : public ExtensionApiTest {
return ExtensionSystem::Get(browser()->profile())->extension_service();
}
- FakeSigninManagerForTesting* signin_manager_;
- FakeProfileOAuth2TokenService* token_service_;
-
private:
- scoped_ptr<base::CallbackList<void(content::BrowserContext*)>::Subscription>
- will_create_browser_context_services_subscription_;
-
base::ScopedTempDir webstore_install_dir_;
// WebstoreInstaller needs a reference to a FilePath when setting the download
// directory for testing.
@@ -458,133 +399,6 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebstoreGetWebGLStatusTest, Blocked) {
RunTest(webgl_allowed);
}
-IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest,
- SignIn_UserGestureRequired) {
- GURL page_url = GetTestServerURL("sign_in_user_gesture_required.html");
- ASSERT_TRUE(RunPageTest(page_url.spec()));
-}
-
-IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest,
- SignIn_MissingContinueUrl) {
- GURL page_url = GetTestServerURL("sign_in_missing_continue_url.html");
- ASSERT_TRUE(RunPageTest(page_url.spec()));
-}
-
-IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest,
- SignIn_InvalidContinueUrl) {
- GURL page_url = GetTestServerURL("sign_in_invalid_continue_url.html");
- ASSERT_TRUE(RunPageTest(page_url.spec()));
-}
-
-IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest,
- SignIn_ContinueUrlOnDifferentOrigin) {
- GURL page_url =
- GetTestServerURL("sign_in_continue_url_on_different_origin.html");
- ASSERT_TRUE(RunPageTest(page_url.spec()));
-}
-
-IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest,
- SignIn_DisallowedInIncognito) {
- // Make sure that the test is testing something more than the absence of a
- // sign-in manager for this profile.
- ASSERT_TRUE(SigninManagerFactory::GetForProfile(profile()));
-
- GURL page_url =
- GetTestServerURL("sign_in_disallowed_in_incognito.html");
- ASSERT_TRUE(
- RunPageTest(page_url.spec(), ExtensionApiTest::kFlagUseIncognito));
-}
-
-IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest,
- SignIn_DisabledWhenWebBasedSigninIsEnabled) {
- // Make sure that the test is testing something more than the absence of a
- // sign-in manager for this profile.
- ASSERT_TRUE(SigninManagerFactory::GetForProfile(profile()));
-
- CommandLine::ForCurrentProcess()->AppendSwitch(
- switches::kEnableWebBasedSignin);
- GURL page_url = GetTestServerURL(
- "sign_in_disabled_when_web_based_signin_is_enabled.html");
- ASSERT_TRUE(RunPageTest(page_url.spec()));
-}
-
-IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest,
- SignIn_AlreadySignedIn) {
- signin_manager_->SetAuthenticatedUsername("user@example.com");
- GURL page_url = GetTestServerURL("sign_in_already_signed_in.html");
- ASSERT_TRUE(RunPageTest(page_url.spec()));
-}
-
-// The FakeSignInManager class is not implemented for ChromeOS, so there's no
-// straightforward way to test these flows on that platform.
-#if !defined(OS_CHROMEOS)
-IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest,
- SignIn_AuthInProgress_Fails) {
- // Initiate an authentication that will be in progress when the sign-in API is
- // called.
- signin_manager_->set_auth_in_progress("user@example.com");
-
- // Navigate to the page, which will cause the sign-in API to be called.
- // Then, complete the authentication in a failed state.
- ResultCatcher catcher;
- StartSignInTest("sign_in_auth_in_progress_fails.html");
- signin_manager_->FailSignin(GoogleServiceAuthError::AuthErrorNone());
- ASSERT_TRUE(catcher.GetNextResult());
-}
-
-IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest,
- SignIn_AuthInProgress_MergeSessionFails) {
- // Initiate an authentication that will be in progress when the sign-in API is
- // called.
- signin_manager_->set_auth_in_progress("user@example.com");
-
- // Navigate to the page, which will cause the sign-in API to be called.
- // Then, complete the authentication in a successful state.
- ResultCatcher catcher;
- StartSignInTest("sign_in_auth_in_progress_merge_session_fails.html");
- signin_manager_->CompletePendingSignin();
- token_service_->IssueRefreshTokenForUser("user@example.com", "token");
- signin_manager_->NotifyMergeSessionObservers(
- GoogleServiceAuthError(GoogleServiceAuthError::SERVICE_UNAVAILABLE));
- ASSERT_TRUE(catcher.GetNextResult());
-}
-
-IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest,
- SignIn_AuthInProgress_Succeeds) {
- // Initiate an authentication that will be in progress when the sign-in API is
- // called.
- signin_manager_->set_auth_in_progress("user@example.com");
-
- // Navigate to the page, which will cause the sign-in API to be called.
- // Then, complete the authentication in a successful state.
- ResultCatcher catcher;
- StartSignInTest("sign_in_auth_in_progress_succeeds.html");
- signin_manager_->CompletePendingSignin();
- token_service_->IssueRefreshTokenForUser("user@example.com", "token");
- signin_manager_->NotifyMergeSessionObservers(
- GoogleServiceAuthError::AuthErrorNone());
- ASSERT_TRUE(catcher.GetNextResult());
-}
-#endif // !defined (OS_CHROMEOS)
-
-IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest,
- SignIn_RedirectToSignIn) {
- GURL signin_url(
- "chrome://chrome-signin/?source=5&"
- "continue=http%3A%2F%2Fwww.example.com%3A" +
- base::IntToString(test_server()->host_port_pair().port()) +
- "%2Fcontinue");
- ui_test_utils::UrlLoadObserver observer(
- signin_url,
- content::Source<content::NavigationController>(
- &GetWebContents()->GetController()));
- StartSignInTest("sign_in_redirect_to_sign_in.html");
- observer.Wait();
-
- // TODO(isherman): Also test the redirect back to the continue URL once
- // sign-in completes?
-}
-
class EphemeralAppWebstorePrivateApiTest
: public ExtensionWebstorePrivateApiTest {
public:

Powered by Google App Engine
This is Rietveld 408576698