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 2205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2216 run_loop.Run(); | 2216 run_loop.Run(); |
2217 | 2217 |
2218 // |app_identifier| should no longer be stored in prefs. | 2218 // |app_identifier| should no longer be stored in prefs. |
2219 PushMessagingAppIdentifier stored_app_identifier = | 2219 PushMessagingAppIdentifier stored_app_identifier = |
2220 PushMessagingAppIdentifier::FindByAppId(GetBrowser()->profile(), app_id); | 2220 PushMessagingAppIdentifier::FindByAppId(GetBrowser()->profile(), app_id); |
2221 EXPECT_TRUE(stored_app_identifier.is_null()); | 2221 EXPECT_TRUE(stored_app_identifier.is_null()); |
2222 | 2222 |
2223 histogram_tester_.ExpectUniqueSample( | 2223 histogram_tester_.ExpectUniqueSample( |
2224 "PushMessaging.UnregistrationReason", | 2224 "PushMessaging.UnregistrationReason", |
2225 content::PUSH_UNREGISTRATION_REASON_PERMISSION_REVOKED, 1); | 2225 content::PUSH_UNREGISTRATION_REASON_PERMISSION_REVOKED, 1); |
| 2226 |
| 2227 base::RunLoop().RunUntilIdle(); |
| 2228 |
2226 // Revoked permission should trigger an automatic unsubscription attempt. | 2229 // Revoked permission should trigger an automatic unsubscription attempt. |
2227 EXPECT_EQ(app_id, gcm_driver_->last_deletetoken_app_id()); | 2230 EXPECT_EQ(app_id, gcm_driver_->last_deletetoken_app_id()); |
2228 } | 2231 } |
2229 | 2232 |
2230 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, EncryptionKeyUniqueness) { | 2233 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, EncryptionKeyUniqueness) { |
2231 std::string token1; | 2234 std::string token1; |
2232 ASSERT_NO_FATAL_FAILURE(SubscribeSuccessfully(false /* use_key */, &token1)); | 2235 ASSERT_NO_FATAL_FAILURE(SubscribeSuccessfully(false /* use_key */, &token1)); |
2233 | 2236 |
2234 std::string first_public_key; | 2237 std::string first_public_key; |
2235 ASSERT_TRUE(RunScript("GetP256dh()", &first_public_key)); | 2238 ASSERT_TRUE(RunScript("GetP256dh()", &first_public_key)); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2376 push_service()->SetUnsubscribeCallbackForTesting(run_loop.QuitClosure()); | 2379 push_service()->SetUnsubscribeCallbackForTesting(run_loop.QuitClosure()); |
2377 ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); | 2380 ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); |
2378 EXPECT_EQ("unsubscribe result: true", script_result); | 2381 EXPECT_EQ("unsubscribe result: true", script_result); |
2379 // Background mode is only guaranteed to have updated once the unsubscribe | 2382 // Background mode is only guaranteed to have updated once the unsubscribe |
2380 // callback for testing has been run (PushSubscription.unsubscribe() usually | 2383 // callback for testing has been run (PushSubscription.unsubscribe() usually |
2381 // resolves before that, in order to avoid blocking on network retries etc). | 2384 // resolves before that, in order to avoid blocking on network retries etc). |
2382 run_loop.Run(); | 2385 run_loop.Run(); |
2383 ASSERT_FALSE(background_mode_manager->IsBackgroundModeActive()); | 2386 ASSERT_FALSE(background_mode_manager->IsBackgroundModeActive()); |
2384 } | 2387 } |
2385 #endif // BUILDFLAG(ENABLE_BACKGROUND) && !defined(OS_CHROMEOS) | 2388 #endif // BUILDFLAG(ENABLE_BACKGROUND) && !defined(OS_CHROMEOS) |
OLD | NEW |