OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/leak_annotations.h" | 9 #include "base/debug/leak_annotations.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 void GCMEventRouterMock::OnSendError(const std::string& app_id, | 290 void GCMEventRouterMock::OnSendError(const std::string& app_id, |
291 const std::string& message_id, | 291 const std::string& message_id, |
292 GCMClient::Result result) { | 292 GCMClient::Result result) { |
293 received_event_ = SEND_ERROR_EVENT; | 293 received_event_ = SEND_ERROR_EVENT; |
294 app_id_ = app_id; | 294 app_id_ = app_id; |
295 send_error_message_id_ = message_id; | 295 send_error_message_id_ = message_id; |
296 send_error_result_ = result; | 296 send_error_result_ = result; |
297 test_->SignalCompleted(); | 297 test_->SignalCompleted(); |
298 } | 298 } |
299 | 299 |
| 300 TEST_F(GCMProfileServiceTest, Incognito) { |
| 301 EXPECT_TRUE(GCMProfileServiceFactory::GetForProfile(profile())); |
| 302 |
| 303 // Create an incognito profile. |
| 304 TestingProfile::Builder incognito_profile_builder; |
| 305 incognito_profile_builder.SetIncognito(); |
| 306 scoped_ptr<TestingProfile> incognito_profile = |
| 307 incognito_profile_builder.Build(); |
| 308 incognito_profile->SetOriginalProfile(profile()); |
| 309 |
| 310 EXPECT_FALSE(GCMProfileServiceFactory::GetForProfile( |
| 311 incognito_profile.get())); |
| 312 } |
| 313 |
300 TEST_F(GCMProfileServiceTest, CheckIn) { | 314 TEST_F(GCMProfileServiceTest, CheckIn) { |
301 EXPECT_TRUE(checkin_info_.IsValid()); | 315 EXPECT_TRUE(checkin_info_.IsValid()); |
302 | 316 |
303 GCMClient::CheckinInfo expected_checkin_info = | 317 GCMClient::CheckinInfo expected_checkin_info = |
304 GCMClientMock::GetCheckinInfoFromUsername(kTestingUsername); | 318 GCMClientMock::GetCheckinInfoFromUsername(kTestingUsername); |
305 EXPECT_EQ(expected_checkin_info.android_id, checkin_info_.android_id); | 319 EXPECT_EQ(expected_checkin_info.android_id, checkin_info_.android_id); |
306 EXPECT_EQ(expected_checkin_info.secret, checkin_info_.secret); | 320 EXPECT_EQ(expected_checkin_info.secret, checkin_info_.secret); |
307 } | 321 } |
308 | 322 |
309 TEST_F(GCMProfileServiceTest, CheckInFromPrefsStore) { | 323 TEST_F(GCMProfileServiceTest, CheckInFromPrefsStore) { |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 | 700 |
687 TEST_F(GCMProfileServiceTest, MessagesDeleted) { | 701 TEST_F(GCMProfileServiceTest, MessagesDeleted) { |
688 GetGCMClientMock()->DeleteMessages(kTestingUsername, kTestingAppId); | 702 GetGCMClientMock()->DeleteMessages(kTestingUsername, kTestingAppId); |
689 WaitForCompleted(); | 703 WaitForCompleted(); |
690 EXPECT_EQ(GCMEventRouterMock::MESSAGES_DELETED_EVENT, | 704 EXPECT_EQ(GCMEventRouterMock::MESSAGES_DELETED_EVENT, |
691 gcm_event_router_mock_->received_event()); | 705 gcm_event_router_mock_->received_event()); |
692 EXPECT_EQ(kTestingAppId, gcm_event_router_mock_->app_id()); | 706 EXPECT_EQ(kTestingAppId, gcm_event_router_mock_->app_id()); |
693 } | 707 } |
694 | 708 |
695 } // namespace gcm | 709 } // namespace gcm |
OLD | NEW |