OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 1399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1410 EXPECT_EQ(app_identifier.app_id(), gcm_service()->last_registered_app_id()); | 1410 EXPECT_EQ(app_identifier.app_id(), gcm_service()->last_registered_app_id()); |
1411 PushMessagingAppIdentifier stored_app_identifier = | 1411 PushMessagingAppIdentifier stored_app_identifier = |
1412 PushMessagingAppIdentifier::FindByAppId(GetBrowser()->profile(), | 1412 PushMessagingAppIdentifier::FindByAppId(GetBrowser()->profile(), |
1413 app_identifier.app_id()); | 1413 app_identifier.app_id()); |
1414 EXPECT_FALSE(stored_app_identifier.is_null()); | 1414 EXPECT_FALSE(stored_app_identifier.is_null()); |
1415 | 1415 |
1416 // Simulate a user clearing site data (including Service Workers, crucially). | 1416 // Simulate a user clearing site data (including Service Workers, crucially). |
1417 BrowsingDataRemover* remover = | 1417 BrowsingDataRemover* remover = |
1418 BrowsingDataRemoverFactory::GetForBrowserContext(GetBrowser()->profile()); | 1418 BrowsingDataRemoverFactory::GetForBrowserContext(GetBrowser()->profile()); |
1419 BrowsingDataRemoverCompletionObserver observer(remover); | 1419 BrowsingDataRemoverCompletionObserver observer(remover); |
1420 remover->Remove(BrowsingDataRemover::Unbounded(), | 1420 remover->RemoveAndReply(BrowsingDataRemover::Unbounded(), |
1421 BrowsingDataRemover::REMOVE_SITE_DATA, | 1421 BrowsingDataRemover::REMOVE_SITE_DATA, |
1422 BrowsingDataHelper::UNPROTECTED_WEB); | 1422 BrowsingDataHelper::UNPROTECTED_WEB, &observer); |
1423 observer.BlockUntilCompletion(); | 1423 observer.BlockUntilCompletion(); |
1424 | 1424 |
1425 base::RunLoop run_loop; | 1425 base::RunLoop run_loop; |
1426 push_service()->SetContentSettingChangedCallbackForTesting( | 1426 push_service()->SetContentSettingChangedCallbackForTesting( |
1427 run_loop.QuitClosure()); | 1427 run_loop.QuitClosure()); |
1428 | 1428 |
1429 // This shouldn't (asynchronously) cause a DCHECK. | 1429 // This shouldn't (asynchronously) cause a DCHECK. |
1430 // TODO(johnme): Get this test running on Android, which has a different | 1430 // TODO(johnme): Get this test running on Android, which has a different |
1431 // codepath due to sender_id being required for unsubscribing there. | 1431 // codepath due to sender_id being required for unsubscribing there. |
1432 HostContentSettingsMapFactory::GetForProfile(GetBrowser()->profile()) | 1432 HostContentSettingsMapFactory::GetForProfile(GetBrowser()->profile()) |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1573 ASSERT_FALSE(background_mode_manager->IsBackgroundModeActive()); | 1573 ASSERT_FALSE(background_mode_manager->IsBackgroundModeActive()); |
1574 | 1574 |
1575 // After dropping the last subscription background mode is still inactive. | 1575 // After dropping the last subscription background mode is still inactive. |
1576 std::string script_result; | 1576 std::string script_result; |
1577 gcm_service()->AddExpectedUnregisterResponse(gcm::GCMClient::SUCCESS); | 1577 gcm_service()->AddExpectedUnregisterResponse(gcm::GCMClient::SUCCESS); |
1578 ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); | 1578 ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); |
1579 EXPECT_EQ("unsubscribe result: true", script_result); | 1579 EXPECT_EQ("unsubscribe result: true", script_result); |
1580 ASSERT_FALSE(background_mode_manager->IsBackgroundModeActive()); | 1580 ASSERT_FALSE(background_mode_manager->IsBackgroundModeActive()); |
1581 } | 1581 } |
1582 #endif // BUILDFLAG(ENABLE_BACKGROUND) && !defined(OS_CHROMEOS) | 1582 #endif // BUILDFLAG(ENABLE_BACKGROUND) && !defined(OS_CHROMEOS) |
OLD | NEW |