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

Side by Side Diff: chrome/browser/signin/account_reconcilor_unittest.cc

Issue 323133005: Enable consistent identity on android platform by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "build/build_config.h"
10 #include "chrome/browser/prefs/pref_service_syncable.h" 11 #include "chrome/browser/prefs/pref_service_syncable.h"
11 #include "chrome/browser/signin/account_reconcilor_factory.h" 12 #include "chrome/browser/signin/account_reconcilor_factory.h"
12 #include "chrome/browser/signin/chrome_signin_client_factory.h" 13 #include "chrome/browser/signin/chrome_signin_client_factory.h"
13 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" 14 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
14 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" 15 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h"
15 #include "chrome/browser/signin/fake_signin_manager.h" 16 #include "chrome/browser/signin/fake_signin_manager.h"
16 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 17 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
17 #include "chrome/browser/signin/signin_manager_factory.h" 18 #include "chrome/browser/signin/signin_manager_factory.h"
18 #include "chrome/browser/signin/test_signin_client_builder.h" 19 #include "chrome/browser/signin/test_signin_client_builder.h"
19 #include "chrome/test/base/testing_browser_process.h" 20 #include "chrome/test/base/testing_browser_process.h"
20 #include "chrome/test/base/testing_profile.h" 21 #include "chrome/test/base/testing_profile.h"
21 #include "chrome/test/base/testing_profile_manager.h" 22 #include "chrome/test/base/testing_profile_manager.h"
22 #include "components/signin/core/browser/account_reconcilor.h" 23 #include "components/signin/core/browser/account_reconcilor.h"
23 #include "components/signin/core/browser/profile_oauth2_token_service.h" 24 #include "components/signin/core/browser/profile_oauth2_token_service.h"
24 #include "components/signin/core/browser/signin_manager.h" 25 #include "components/signin/core/browser/signin_manager.h"
25 //#include "components/signin/core/browser/test_signin_client.h"
26 #include "components/signin/core/common/signin_switches.h" 26 #include "components/signin/core/common/signin_switches.h"
27 #include "content/public/test/test_browser_thread_bundle.h" 27 #include "content/public/test/test_browser_thread_bundle.h"
28 #include "google_apis/gaia/gaia_urls.h" 28 #include "google_apis/gaia/gaia_urls.h"
29 #include "net/url_request/test_url_fetcher_factory.h" 29 #include "net/url_request/test_url_fetcher_factory.h"
30 #include "testing/gmock/include/gmock/gmock.h" 30 #include "testing/gmock/include/gmock/gmock.h"
31 #include "testing/gtest/include/gtest/gtest.h" 31 #include "testing/gtest/include/gtest/gtest.h"
32 32
33 namespace { 33 namespace {
34 34
35 const char kTestEmail[] = "user@gmail.com"; 35 const char kTestEmail[] = "user@gmail.com";
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 scoped_ptr<TestingProfileManager> testing_profile_manager_; 114 scoped_ptr<TestingProfileManager> testing_profile_manager_;
115 }; 115 };
116 116
117 AccountReconcilorTest::AccountReconcilorTest() 117 AccountReconcilorTest::AccountReconcilorTest()
118 : signin_manager_(NULL), 118 : signin_manager_(NULL),
119 token_service_(NULL), 119 token_service_(NULL),
120 mock_reconcilor_(NULL), 120 mock_reconcilor_(NULL),
121 url_fetcher_factory_(NULL) {} 121 url_fetcher_factory_(NULL) {}
122 122
123 void AccountReconcilorTest::SetUp() { 123 void AccountReconcilorTest::SetUp() {
124 #if defined(OS_ANDROID)
125 DCHECK(!CommandLine::ForCurrentProcess()->HasSwitch(
126 switches::kDisableNewProfileManagement));
127 #else
124 CommandLine::ForCurrentProcess()->AppendSwitch( 128 CommandLine::ForCurrentProcess()->AppendSwitch(
125 switches::kNewProfileManagement); 129 switches::kEnableNewProfileManagement);
130 #endif
126 131
127 testing_profile_manager_.reset( 132 testing_profile_manager_.reset(
128 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); 133 new TestingProfileManager(TestingBrowserProcess::GetGlobal()));
129 ASSERT_TRUE(testing_profile_manager_.get()->SetUp()); 134 ASSERT_TRUE(testing_profile_manager_.get()->SetUp());
130 135
131 TestingProfile::TestingFactories factories; 136 TestingProfile::TestingFactories factories;
132 factories.push_back(std::make_pair(ChromeSigninClientFactory::GetInstance(), 137 factories.push_back(std::make_pair(ChromeSigninClientFactory::GetInstance(),
133 signin::BuildTestSigninClient)); 138 signin::BuildTestSigninClient));
134 factories.push_back(std::make_pair( 139 factories.push_back(std::make_pair(
135 ProfileOAuth2TokenServiceFactory::GetInstance(), 140 ProfileOAuth2TokenServiceFactory::GetInstance(),
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 token_service()->IssueAllTokensForAccount("user@gmail.com", "access_token", 589 token_service()->IssueAllTokensForAccount("user@gmail.com", "access_token",
585 base::Time::Now() + base::TimeDelta::FromHours(1)); 590 base::Time::Now() + base::TimeDelta::FromHours(1));
586 token_service()->IssueAllTokensForAccount("other@gmail.com", "access_token", 591 token_service()->IssueAllTokensForAccount("other@gmail.com", "access_token",
587 base::Time::Now() + base::TimeDelta::FromHours(1)); 592 base::Time::Now() + base::TimeDelta::FromHours(1));
588 593
589 base::RunLoop().RunUntilIdle(); 594 base::RunLoop().RunUntilIdle();
590 SimulateMergeSessionCompleted(reconcilor, "user@gmail.com", 595 SimulateMergeSessionCompleted(reconcilor, "user@gmail.com",
591 GoogleServiceAuthError::AuthErrorNone()); 596 GoogleServiceAuthError::AuthErrorNone());
592 ASSERT_FALSE(reconcilor->is_reconcile_started_); 597 ASSERT_FALSE(reconcilor->is_reconcile_started_);
593 } 598 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698