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

Side by Side Diff: chrome/browser/ui/webui/sync_setup_handler_unittest.cc

Issue 14630003: signin: move SigninManagerBase::Signout to SigninManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/ui/webui/sync_setup_handler.h" 5 #include "chrome/browser/ui/webui/sync_setup_handler.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 // complete yet). 786 // complete yet).
787 handler_->TryLogin(kTestUser, kTestPassword, std::string(), std::string()); 787 handler_->TryLogin(kTestUser, kTestPassword, std::string(), std::string());
788 handler_->GaiaCredentialsValid(); 788 handler_->GaiaCredentialsValid();
789 ASSERT_EQ(2U, web_ui_.call_data().size()); 789 ASSERT_EQ(2U, web_ui_.call_data().size());
790 EXPECT_EQ("SyncSetupOverlay.showSuccessAndSettingUp", 790 EXPECT_EQ("SyncSetupOverlay.showSuccessAndSettingUp",
791 web_ui_.call_data()[1].function_name); 791 web_ui_.call_data()[1].function_name);
792 // Now fake a sync error. 792 // Now fake a sync error.
793 GoogleServiceAuthError none(GoogleServiceAuthError::NONE); 793 GoogleServiceAuthError none(GoogleServiceAuthError::NONE);
794 EXPECT_CALL(*mock_pss_, HasUnrecoverableError()) 794 EXPECT_CALL(*mock_pss_, HasUnrecoverableError())
795 .WillRepeatedly(Return(true)); 795 .WillRepeatedly(Return(true));
796 mock_signin_->SignOut(); 796 // On non-Cros platforms, we use SigninManager.
797 static_cast<SigninManager*>(mock_signin_)->SignOut();
797 handler_->SigninFailed(none); 798 handler_->SigninFailed(none);
798 ASSERT_EQ(3U, web_ui_.call_data().size()); 799 ASSERT_EQ(3U, web_ui_.call_data().size());
799 // Validate the second JS call (the first call was already tested by 800 // Validate the second JS call (the first call was already tested by
800 // the DisplayBasicLogin test). 801 // the DisplayBasicLogin test).
801 const TestWebUI::CallData& data = web_ui_.call_data()[2]; 802 const TestWebUI::CallData& data = web_ui_.call_data()[2];
802 EXPECT_EQ("SyncSetupOverlay.showSyncSetupPage", data.function_name); 803 EXPECT_EQ("SyncSetupOverlay.showSyncSetupPage", data.function_name);
803 std::string page; 804 std::string page;
804 ASSERT_TRUE(data.arg1->GetAsString(&page)); 805 ASSERT_TRUE(data.arg1->GetAsString(&page));
805 EXPECT_EQ(page, "login"); 806 EXPECT_EQ(page, "login");
806 // Now make sure that the appropriate params are being passed. 807 // Now make sure that the appropriate params are being passed.
(...skipping 29 matching lines...) Expand all
836 handler_->TryLogin(kTestUser, kTestPassword, std::string(), std::string()); 837 handler_->TryLogin(kTestUser, kTestPassword, std::string(), std::string());
837 handler_->GaiaCredentialsValid(); 838 handler_->GaiaCredentialsValid();
838 ASSERT_EQ(2U, web_ui_.call_data().size()); 839 ASSERT_EQ(2U, web_ui_.call_data().size());
839 EXPECT_EQ("SyncSetupOverlay.showSuccessAndSettingUp", 840 EXPECT_EQ("SyncSetupOverlay.showSuccessAndSettingUp",
840 web_ui_.call_data()[1].function_name); 841 web_ui_.call_data()[1].function_name);
841 // Now fake a sync gaia error. 842 // Now fake a sync gaia error.
842 GoogleServiceAuthError unavailable( 843 GoogleServiceAuthError unavailable(
843 GoogleServiceAuthError::SERVICE_UNAVAILABLE); 844 GoogleServiceAuthError::SERVICE_UNAVAILABLE);
844 EXPECT_CALL(*mock_pss_, HasUnrecoverableError()) 845 EXPECT_CALL(*mock_pss_, HasUnrecoverableError())
845 .WillRepeatedly(Return(false)); 846 .WillRepeatedly(Return(false));
846 mock_signin_->SignOut(); 847 // On non-Cros platforms, we use SigninManager.
848 static_cast<SigninManager*>(mock_signin_)->SignOut();
847 handler_->SigninFailed(unavailable); 849 handler_->SigninFailed(unavailable);
848 ASSERT_EQ(3U, web_ui_.call_data().size()); 850 ASSERT_EQ(3U, web_ui_.call_data().size());
849 // Validate the second JS call (the first call was already tested by 851 // Validate the second JS call (the first call was already tested by
850 // the DisplayBasicLogin test). 852 // the DisplayBasicLogin test).
851 const TestWebUI::CallData& data = web_ui_.call_data()[2]; 853 const TestWebUI::CallData& data = web_ui_.call_data()[2];
852 EXPECT_EQ("SyncSetupOverlay.showSyncSetupPage", data.function_name); 854 EXPECT_EQ("SyncSetupOverlay.showSyncSetupPage", data.function_name);
853 std::string page; 855 std::string page;
854 ASSERT_TRUE(data.arg1->GetAsString(&page)); 856 ASSERT_TRUE(data.arg1->GetAsString(&page));
855 EXPECT_EQ(page, "login"); 857 EXPECT_EQ(page, "login");
856 // Now make sure that the appropriate params are being passed. 858 // Now make sure that the appropriate params are being passed.
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 ExpectConfig(); 1322 ExpectConfig();
1321 const TestWebUI::CallData& data = web_ui_.call_data()[0]; 1323 const TestWebUI::CallData& data = web_ui_.call_data()[0];
1322 DictionaryValue* dictionary; 1324 DictionaryValue* dictionary;
1323 ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary)); 1325 ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary));
1324 CheckBool(dictionary, "encryptAllData", true); 1326 CheckBool(dictionary, "encryptAllData", true);
1325 } 1327 }
1326 1328
1327 INSTANTIATE_TEST_CASE_P(SyncSetupHandlerTestWithParam, 1329 INSTANTIATE_TEST_CASE_P(SyncSetupHandlerTestWithParam,
1328 SyncSetupHandlerTest, 1330 SyncSetupHandlerTest,
1329 Values(true, false)); 1331 Values(true, false));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698