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 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1953 GetAppIdentifierForServiceWorkerRegistration(0LL); | 1953 GetAppIdentifierForServiceWorkerRegistration(0LL); |
1954 PushMessagingAppIdentifier stored_app_identifier = | 1954 PushMessagingAppIdentifier stored_app_identifier = |
1955 PushMessagingAppIdentifier::FindByAppId(GetBrowser()->profile(), | 1955 PushMessagingAppIdentifier::FindByAppId(GetBrowser()->profile(), |
1956 app_identifier.app_id()); | 1956 app_identifier.app_id()); |
1957 EXPECT_FALSE(stored_app_identifier.is_null()); | 1957 EXPECT_FALSE(stored_app_identifier.is_null()); |
1958 | 1958 |
1959 // Simulate a user clearing site data (including Service Workers, crucially). | 1959 // Simulate a user clearing site data (including Service Workers, crucially). |
1960 BrowsingDataRemover* remover = | 1960 BrowsingDataRemover* remover = |
1961 BrowsingDataRemoverFactory::GetForBrowserContext(GetBrowser()->profile()); | 1961 BrowsingDataRemoverFactory::GetForBrowserContext(GetBrowser()->profile()); |
1962 BrowsingDataRemoverCompletionObserver observer(remover); | 1962 BrowsingDataRemoverCompletionObserver observer(remover); |
1963 remover->RemoveAndReply(BrowsingDataRemover::Unbounded(), | 1963 remover->RemoveAndReply(base::Time(), base::Time::Max(), |
1964 BrowsingDataRemover::REMOVE_SITE_DATA, | 1964 BrowsingDataRemover::REMOVE_SITE_DATA, |
1965 BrowsingDataHelper::UNPROTECTED_WEB, &observer); | 1965 BrowsingDataHelper::UNPROTECTED_WEB, &observer); |
1966 observer.BlockUntilCompletion(); | 1966 observer.BlockUntilCompletion(); |
1967 | 1967 |
1968 base::RunLoop run_loop; | 1968 base::RunLoop run_loop; |
1969 push_service()->SetContentSettingChangedCallbackForTesting( | 1969 push_service()->SetContentSettingChangedCallbackForTesting( |
1970 run_loop.QuitClosure()); | 1970 run_loop.QuitClosure()); |
1971 | 1971 |
1972 // This shouldn't (asynchronously) cause a DCHECK. | 1972 // This shouldn't (asynchronously) cause a DCHECK. |
1973 // TODO(johnme): Get this test running on Android with legacy GCM | 1973 // TODO(johnme): Get this test running on Android with legacy GCM |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2120 ASSERT_NO_FATAL_FAILURE(SubscribeSuccessfully()); | 2120 ASSERT_NO_FATAL_FAILURE(SubscribeSuccessfully()); |
2121 ASSERT_FALSE(background_mode_manager->IsBackgroundModeActive()); | 2121 ASSERT_FALSE(background_mode_manager->IsBackgroundModeActive()); |
2122 | 2122 |
2123 // After dropping the last subscription background mode is still inactive. | 2123 // After dropping the last subscription background mode is still inactive. |
2124 std::string script_result; | 2124 std::string script_result; |
2125 ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); | 2125 ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); |
2126 EXPECT_EQ("unsubscribe result: true", script_result); | 2126 EXPECT_EQ("unsubscribe result: true", script_result); |
2127 ASSERT_FALSE(background_mode_manager->IsBackgroundModeActive()); | 2127 ASSERT_FALSE(background_mode_manager->IsBackgroundModeActive()); |
2128 } | 2128 } |
2129 #endif // BUILDFLAG(ENABLE_BACKGROUND) && !defined(OS_CHROMEOS) | 2129 #endif // BUILDFLAG(ENABLE_BACKGROUND) && !defined(OS_CHROMEOS) |
OLD | NEW |