OLD | NEW |
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" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/message_loop.h" |
12 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
13 #include "base/values.h" | 14 #include "base/values.h" |
14 #include "chrome/browser/prefs/pref_service.h" | 15 #include "chrome/browser/prefs/pref_service.h" |
15 #include "chrome/browser/signin/signin_manager_factory.h" | 16 #include "chrome/browser/signin/signin_manager_factory.h" |
16 #include "chrome/browser/signin/signin_manager_fake.h" | 17 #include "chrome/browser/signin/signin_manager_fake.h" |
17 #include "chrome/browser/sync/profile_sync_service_factory.h" | 18 #include "chrome/browser/sync/profile_sync_service_factory.h" |
18 #include "chrome/browser/sync/profile_sync_service_mock.h" | 19 #include "chrome/browser/sync/profile_sync_service_mock.h" |
19 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 20 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
20 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 21 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
21 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" | 22 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 const TestWebUI::CallData& data = web_ui_.call_data()[0]; | 415 const TestWebUI::CallData& data = web_ui_.call_data()[0]; |
415 EXPECT_EQ("SyncSetupOverlay.showSyncSetupPage", data.function_name); | 416 EXPECT_EQ("SyncSetupOverlay.showSyncSetupPage", data.function_name); |
416 std::string page; | 417 std::string page; |
417 ASSERT_TRUE(data.arg1->GetAsString(&page)); | 418 ASSERT_TRUE(data.arg1->GetAsString(&page)); |
418 EXPECT_EQ(page, "done"); | 419 EXPECT_EQ(page, "done"); |
419 } | 420 } |
420 | 421 |
421 scoped_ptr<Profile> profile_; | 422 scoped_ptr<Profile> profile_; |
422 ProfileSyncServiceMock* mock_pss_; | 423 ProfileSyncServiceMock* mock_pss_; |
423 GoogleServiceAuthError error_; | 424 GoogleServiceAuthError error_; |
| 425 // MessageLoop instance is required to work with OneShotTimer. |
| 426 MessageLoop message_loop_; |
424 SigninManagerMock* mock_signin_; | 427 SigninManagerMock* mock_signin_; |
425 TestWebUI web_ui_; | 428 TestWebUI web_ui_; |
426 scoped_ptr<TestingSyncSetupHandler> handler_; | 429 scoped_ptr<TestingSyncSetupHandler> handler_; |
427 }; | 430 }; |
428 | 431 |
429 TEST_P(SyncSetupHandlerTest, Basic) { | 432 TEST_P(SyncSetupHandlerTest, Basic) { |
430 } | 433 } |
431 | 434 |
432 TEST_P(SyncSetupHandlerTest, DisplayBasicLogin) { | 435 TEST_P(SyncSetupHandlerTest, DisplayBasicLogin) { |
433 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) | 436 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 CheckShowSyncSetupArgs( | 1153 CheckShowSyncSetupArgs( |
1151 dictionary, err, false, GoogleServiceAuthError::NONE, "", true, ""); | 1154 dictionary, err, false, GoogleServiceAuthError::NONE, "", true, ""); |
1152 handler_->CloseSyncSetup(); | 1155 handler_->CloseSyncSetup(); |
1153 EXPECT_EQ(NULL, | 1156 EXPECT_EQ(NULL, |
1154 LoginUIServiceFactory::GetForProfile( | 1157 LoginUIServiceFactory::GetForProfile( |
1155 profile_.get())->current_login_ui()); | 1158 profile_.get())->current_login_ui()); |
1156 } | 1159 } |
1157 | 1160 |
1158 INSTANTIATE_TEST_CASE_P(SyncSetupHandlerTest, SyncSetupHandlerTest, | 1161 INSTANTIATE_TEST_CASE_P(SyncSetupHandlerTest, SyncSetupHandlerTest, |
1159 Values(true, false)); | 1162 Values(true, false)); |
OLD | NEW |