| 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 180 |
| 181 InProcessBrowserTest::TearDown(); | 181 InProcessBrowserTest::TearDown(); |
| 182 } | 182 } |
| 183 | 183 |
| 184 void LoadTestPage(const std::string& path) { | 184 void LoadTestPage(const std::string& path) { |
| 185 ui_test_utils::NavigateToURL(GetBrowser(), https_server_->GetURL(path)); | 185 ui_test_utils::NavigateToURL(GetBrowser(), https_server_->GetURL(path)); |
| 186 } | 186 } |
| 187 | 187 |
| 188 void LoadTestPage() { LoadTestPage(GetTestURL()); } | 188 void LoadTestPage() { LoadTestPage(GetTestURL()); } |
| 189 | 189 |
| 190 void LoadTestPageWithoutManifest() { LoadTestPage(GetNoManifestTestURL()); } | |
| 191 | |
| 192 bool RunScript(const std::string& script, std::string* result) { | 190 bool RunScript(const std::string& script, std::string* result) { |
| 193 return RunScript(script, result, nullptr); | 191 return RunScript(script, result, nullptr); |
| 194 } | 192 } |
| 195 | 193 |
| 196 bool RunScript(const std::string& script, std::string* result, | 194 bool RunScript(const std::string& script, std::string* result, |
| 197 content::WebContents* web_contents) { | 195 content::WebContents* web_contents) { |
| 198 if (!web_contents) | 196 if (!web_contents) |
| 199 web_contents = GetBrowser()->tab_strip_model()->GetActiveWebContents(); | 197 web_contents = GetBrowser()->tab_strip_model()->GetActiveWebContents(); |
| 200 return content::ExecuteScriptAndExtractString(web_contents->GetMainFrame(), | 198 return content::ExecuteScriptAndExtractString(web_contents->GetMainFrame(), |
| 201 script, result); | 199 script, result); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 | 264 |
| 267 void SetSiteEngagementScore(const GURL& url, double score) { | 265 void SetSiteEngagementScore(const GURL& url, double score) { |
| 268 SiteEngagementService* service = | 266 SiteEngagementService* service = |
| 269 SiteEngagementService::Get(GetBrowser()->profile()); | 267 SiteEngagementService::Get(GetBrowser()->profile()); |
| 270 service->ResetScoreForURL(url, score); | 268 service->ResetScoreForURL(url, score); |
| 271 } | 269 } |
| 272 | 270 |
| 273 protected: | 271 protected: |
| 274 virtual std::string GetTestURL() { return "/push_messaging/test.html"; } | 272 virtual std::string GetTestURL() { return "/push_messaging/test.html"; } |
| 275 | 273 |
| 276 virtual std::string GetNoManifestTestURL() { | |
| 277 return "/push_messaging/test_no_manifest.html"; | |
| 278 } | |
| 279 | |
| 280 virtual Browser* GetBrowser() const { return browser(); } | 274 virtual Browser* GetBrowser() const { return browser(); } |
| 281 | 275 |
| 282 gcm::FakeGCMProfileService* gcm_service_; | 276 gcm::FakeGCMProfileService* gcm_service_; |
| 283 instance_id::FakeGCMDriverForInstanceID* gcm_driver_; | 277 instance_id::FakeGCMDriverForInstanceID* gcm_driver_; |
| 284 base::HistogramTester histogram_tester_; | 278 base::HistogramTester histogram_tester_; |
| 285 | 279 |
| 286 private: | 280 private: |
| 287 std::unique_ptr<net::EmbeddedTestServer> https_server_; | 281 std::unique_ptr<net::EmbeddedTestServer> https_server_; |
| 288 PushMessagingServiceImpl* push_service_; | 282 PushMessagingServiceImpl* push_service_; |
| 289 | 283 |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 | 538 |
| 545 ASSERT_TRUE(RunScript("isControlled()", &script_result)); | 539 ASSERT_TRUE(RunScript("isControlled()", &script_result)); |
| 546 ASSERT_EQ("true - is controlled", script_result); | 540 ASSERT_EQ("true - is controlled", script_result); |
| 547 | 541 |
| 548 // Try to subscribe from a worker without a key. This should fail. | 542 // Try to subscribe from a worker without a key. This should fail. |
| 549 ASSERT_TRUE(RunScript("workerSubscribePushNoKey()", &script_result)); | 543 ASSERT_TRUE(RunScript("workerSubscribePushNoKey()", &script_result)); |
| 550 EXPECT_EQ( | 544 EXPECT_EQ( |
| 551 "AbortError - Registration failed - missing applicationServerKey, and " | 545 "AbortError - Registration failed - missing applicationServerKey, and " |
| 552 "gcm_sender_id not found in manifest", | 546 "gcm_sender_id not found in manifest", |
| 553 script_result); | 547 script_result); |
| 548 // Now run the subscribe from the service worker with a key. This |
| 549 // should succeed, and write the key to the datastore. |
| 550 ASSERT_TRUE(RunScript("workerSubscribePush()", &script_result)); |
| 551 std::string token1; |
| 552 ASSERT_NO_FATAL_FAILURE( |
| 553 EndpointToToken(script_result, true /* standard_protocol */, &token1)); |
| 554 | 554 |
| 555 // Now run the subscribe with a key. This should succeed. | 555 ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); |
| 556 ASSERT_TRUE(RunScript("workerSubscribePush()", &script_result)); | 556 EXPECT_EQ("unsubscribe result: true", script_result); |
| 557 EXPECT_NE(push_service(), GetAppHandler()); |
| 558 |
| 559 // Now run the subscribe from the service worker without a key. |
| 560 // In this case, the key will be read from the datastore. |
| 561 ASSERT_TRUE(RunScript("workerSubscribePushNoKey()", &script_result)); |
| 562 std::string token2; |
| 557 ASSERT_NO_FATAL_FAILURE( | 563 ASSERT_NO_FATAL_FAILURE( |
| 558 EndpointToToken(script_result, true /* standard_protocol */)); | 564 EndpointToToken(script_result, true /* standard_protocol */, &token2)); |
| 565 EXPECT_NE(token1, token2); |
| 559 | 566 |
| 560 ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); | 567 ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); |
| 561 EXPECT_EQ("unsubscribe result: true", script_result); | 568 EXPECT_EQ("unsubscribe result: true", script_result); |
| 562 EXPECT_NE(push_service(), GetAppHandler()); | 569 EXPECT_NE(push_service(), GetAppHandler()); |
| 563 } | 570 } |
| 564 | 571 |
| 565 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, | 572 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, SubscribeWorkerUsingManifest) { |
| 566 ResubscribeWithoutKeyAfterSubscribingWithKeyInManifest) { | |
| 567 std::string script_result; | 573 std::string script_result; |
| 568 | 574 |
| 569 ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result)); | 575 ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result)); |
| 570 ASSERT_EQ("ok - service worker registered", script_result); | 576 ASSERT_EQ("ok - service worker registered", script_result); |
| 571 | 577 |
| 572 ASSERT_NO_FATAL_FAILURE(RequestAndAcceptPermission()); | 578 ASSERT_NO_FATAL_FAILURE(RequestAndAcceptPermission()); |
| 573 | 579 |
| 574 LoadTestPage(); // Reload to become controlled. | 580 LoadTestPage(); // Reload to become controlled. |
| 575 | 581 |
| 576 ASSERT_TRUE(RunScript("isControlled()", &script_result)); | 582 ASSERT_TRUE(RunScript("isControlled()", &script_result)); |
| 577 ASSERT_EQ("true - is controlled", script_result); | 583 ASSERT_EQ("true - is controlled", script_result); |
| 578 | 584 |
| 585 // Try to subscribe from a worker without a key. This should fail. |
| 586 ASSERT_TRUE(RunScript("workerSubscribePushNoKey()", &script_result)); |
| 587 EXPECT_EQ( |
| 588 "AbortError - Registration failed - missing applicationServerKey, and " |
| 589 "gcm_sender_id not found in manifest", |
| 590 script_result); |
| 591 EXPECT_NE(push_service(), GetAppHandler()); |
| 592 |
| 579 // Run the subscription from the document without a key, this will trigger | 593 // Run the subscription from the document without a key, this will trigger |
| 580 // the code to read sender id from the manifest and will write it to the | 594 // the code to read sender id from the manifest and will write it to the |
| 581 // datastore. | 595 // datastore. |
| 582 ASSERT_TRUE(RunScript("documentSubscribePushWithoutKey()", &script_result)); | 596 ASSERT_TRUE(RunScript("documentSubscribePushWithoutKey()", &script_result)); |
| 583 std::string token1; | 597 std::string token1; |
| 584 ASSERT_NO_FATAL_FAILURE( | 598 ASSERT_NO_FATAL_FAILURE( |
| 585 EndpointToToken(script_result, false /* standard_protocol */, &token1)); | 599 EndpointToToken(script_result, false /* standard_protocol */, &token1)); |
| 586 | 600 |
| 587 ASSERT_TRUE(RunScript("removeManifest()", &script_result)); | |
| 588 ASSERT_EQ("manifest removed", script_result); | |
| 589 | |
| 590 // Try to resubscribe from the document without a key or manifest. | |
| 591 // This should fail. | |
| 592 ASSERT_TRUE(RunScript("documentSubscribePushWithoutKey()", &script_result)); | |
| 593 EXPECT_EQ( | |
| 594 "AbortError - Registration failed - missing applicationServerKey, " | |
| 595 "and manifest empty or missing", | |
| 596 script_result); | |
| 597 | |
| 598 // Now run the subscribe from the service worker without a key. | |
| 599 // In this case, the sender id should be read from the datastore. | |
| 600 ASSERT_TRUE(RunScript("workerSubscribePushNoKey()", &script_result)); | |
| 601 std::string token2; | |
| 602 ASSERT_NO_FATAL_FAILURE( | |
| 603 EndpointToToken(script_result, false /* standard_protocol */, &token2)); | |
| 604 EXPECT_EQ(token1, token2); | |
| 605 | |
| 606 ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); | 601 ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); |
| 607 EXPECT_EQ("unsubscribe result: true", script_result); | 602 EXPECT_EQ("unsubscribe result: true", script_result); |
| 608 EXPECT_NE(push_service(), GetAppHandler()); | 603 EXPECT_NE(push_service(), GetAppHandler()); |
| 609 | 604 |
| 610 // After unsubscribing, subscribe again from the worker with no key. | |
| 611 // The sender id should again be read from the datastore, so the | |
| 612 // subcribe should succeed, and we should get a new subscription token. | |
| 613 ASSERT_TRUE(RunScript("workerSubscribePushNoKey()", &script_result)); | |
| 614 std::string token3; | |
| 615 ASSERT_NO_FATAL_FAILURE( | |
| 616 EndpointToToken(script_result, false /* standard_protocol */, &token3)); | |
| 617 EXPECT_NE(token1, token3); | |
| 618 | |
| 619 ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); | |
| 620 EXPECT_EQ("unsubscribe result: true", script_result); | |
| 621 EXPECT_NE(push_service(), GetAppHandler()); | |
| 622 } | |
| 623 | |
| 624 IN_PROC_BROWSER_TEST_F( | |
| 625 PushMessagingBrowserTest, | |
| 626 ResubscribeWithoutKeyAfterSubscribingFromDocumentWithP256Key) { | |
| 627 std::string script_result; | |
| 628 | |
| 629 ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result)); | |
| 630 ASSERT_EQ("ok - service worker registered", script_result); | |
| 631 | |
| 632 ASSERT_NO_FATAL_FAILURE(RequestAndAcceptPermission()); | |
| 633 | |
| 634 LoadTestPageWithoutManifest(); // Reload to become controlled. | |
| 635 | |
| 636 ASSERT_TRUE(RunScript("isControlled()", &script_result)); | |
| 637 ASSERT_EQ("true - is controlled", script_result); | |
| 638 | |
| 639 // Run the subscription from the document with a key. | |
| 640 ASSERT_TRUE(RunScript("documentSubscribePush()", &script_result)); | |
| 641 ASSERT_NO_FATAL_FAILURE(EndpointToToken(script_result)); | |
| 642 | |
| 643 // Try to resubscribe from the document without a key - should fail. | |
| 644 ASSERT_TRUE(RunScript("documentSubscribePushWithoutKey()", &script_result)); | |
| 645 EXPECT_EQ( | |
| 646 "AbortError - Registration failed - missing applicationServerKey, " | |
| 647 "and manifest empty or missing", | |
| 648 script_result); | |
| 649 | |
| 650 // Now try to resubscribe from the service worker without a key. | |
| 651 // This should also fail as the original key was not numeric. | |
| 652 ASSERT_TRUE(RunScript("workerSubscribePushNoKey()", &script_result)); | |
| 653 EXPECT_EQ( | |
| 654 "AbortError - Registration failed - missing applicationServerKey, " | |
| 655 "and gcm_sender_id not found in manifest", | |
| 656 script_result); | |
| 657 | |
| 658 ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); | |
| 659 EXPECT_EQ("unsubscribe result: true", script_result); | |
| 660 EXPECT_NE(push_service(), GetAppHandler()); | |
| 661 | |
| 662 // After unsubscribing, try to resubscribe again without a key. | |
| 663 // This should again fail. | |
| 664 ASSERT_TRUE(RunScript("workerSubscribePushNoKey()", &script_result)); | |
| 665 EXPECT_EQ( | |
| 666 "AbortError - Registration failed - missing applicationServerKey, " | |
| 667 "and gcm_sender_id not found in manifest", | |
| 668 script_result); | |
| 669 } | |
| 670 | |
| 671 IN_PROC_BROWSER_TEST_F( | |
| 672 PushMessagingBrowserTest, | |
| 673 ResubscribeWithoutKeyAfterSubscribingFromWorkerWithP256Key) { | |
| 674 std::string script_result; | |
| 675 | |
| 676 ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result)); | |
| 677 ASSERT_EQ("ok - service worker registered", script_result); | |
| 678 | |
| 679 ASSERT_NO_FATAL_FAILURE(RequestAndAcceptPermission()); | |
| 680 | |
| 681 LoadTestPageWithoutManifest(); // Reload to become controlled. | |
| 682 | |
| 683 ASSERT_TRUE(RunScript("isControlled()", &script_result)); | |
| 684 ASSERT_EQ("true - is controlled", script_result); | |
| 685 | |
| 686 // Run the subscribe from the service worker with a key. | |
| 687 // This should succeed. | |
| 688 ASSERT_TRUE(RunScript("workerSubscribePush()", &script_result)); | |
| 689 ASSERT_NO_FATAL_FAILURE( | |
| 690 EndpointToToken(script_result, true /* standard_protocol */)); | |
| 691 | |
| 692 // Try to resubscribe from the document without a key - should fail. | |
| 693 ASSERT_TRUE(RunScript("documentSubscribePushWithoutKey()", &script_result)); | |
| 694 EXPECT_EQ( | |
| 695 "AbortError - Registration failed - missing applicationServerKey, " | |
| 696 "and manifest empty or missing", | |
| 697 script_result); | |
| 698 | |
| 699 // Now try to resubscribe from the service worker without a key. | |
| 700 // This should also fail as the original key was not numeric. | |
| 701 ASSERT_TRUE(RunScript("workerSubscribePushNoKey()", &script_result)); | |
| 702 EXPECT_EQ( | |
| 703 "AbortError - Registration failed - missing applicationServerKey, and " | |
| 704 "gcm_sender_id not found in manifest", | |
| 705 script_result); | |
| 706 | |
| 707 ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); | |
| 708 EXPECT_EQ("unsubscribe result: true", script_result); | |
| 709 | |
| 710 // After unsubscribing, try to resubscribe again without a key. | |
| 711 // This should again fail. | |
| 712 ASSERT_TRUE(RunScript("workerSubscribePushNoKey()", &script_result)); | |
| 713 EXPECT_EQ( | |
| 714 "AbortError - Registration failed - missing applicationServerKey, " | |
| 715 "and gcm_sender_id not found in manifest", | |
| 716 script_result); | |
| 717 } | |
| 718 | |
| 719 IN_PROC_BROWSER_TEST_F( | |
| 720 PushMessagingBrowserTest, | |
| 721 ResubscribeWithoutKeyAfterSubscribingFromDocumentWithNumber) { | |
| 722 std::string script_result; | |
| 723 | |
| 724 ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result)); | |
| 725 ASSERT_EQ("ok - service worker registered", script_result); | |
| 726 | |
| 727 ASSERT_NO_FATAL_FAILURE(RequestAndAcceptPermission()); | |
| 728 | |
| 729 LoadTestPageWithoutManifest(); // Reload to become controlled. | |
| 730 | |
| 731 ASSERT_TRUE(RunScript("isControlled()", &script_result)); | |
| 732 ASSERT_EQ("true - is controlled", script_result); | |
| 733 | |
| 734 // Run the subscribe from the document with a numeric key. | |
| 735 // This should succeed. | |
| 736 ASSERT_TRUE( | |
| 737 RunScript("documentSubscribePushWithNumericKey()", &script_result)); | |
| 738 std::string token1; | |
| 739 ASSERT_NO_FATAL_FAILURE( | |
| 740 EndpointToToken(script_result, false /* standard_protocol */, &token1)); | |
| 741 | |
| 742 // Try to resubscribe from the document without a key - should fail. | |
| 743 ASSERT_TRUE(RunScript("documentSubscribePushWithoutKey()", &script_result)); | |
| 744 EXPECT_EQ( | |
| 745 "AbortError - Registration failed - missing applicationServerKey, " | |
| 746 "and manifest empty or missing", | |
| 747 script_result); | |
| 748 | |
| 749 // Now run the subscribe from the service worker without a key. | 605 // Now run the subscribe from the service worker without a key. |
| 750 // In this case, the sender id should be read from the datastore. | 606 // In this case, the sender id will be read from the datastore. |
| 751 // Note, we would rather this failed as we only really want to support | |
| 752 // no-key subscribes after subscribing with a numeric gcm sender id in the | |
| 753 // manifest, not a numeric applicationServerKey, but for code simplicity | |
| 754 // this case is allowed. | |
| 755 ASSERT_TRUE(RunScript("workerSubscribePushNoKey()", &script_result)); | 607 ASSERT_TRUE(RunScript("workerSubscribePushNoKey()", &script_result)); |
| 756 std::string token2; | 608 std::string token2; |
| 757 ASSERT_NO_FATAL_FAILURE( | 609 ASSERT_NO_FATAL_FAILURE( |
| 758 EndpointToToken(script_result, false /* standard_protocol */, &token2)); | 610 EndpointToToken(script_result, false /* standard_protocol */, &token2)); |
| 759 EXPECT_EQ(token1, token2); | 611 EXPECT_NE(token1, token2); |
| 760 | 612 |
| 761 ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); | 613 ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); |
| 762 EXPECT_EQ("unsubscribe result: true", script_result); | 614 EXPECT_EQ("unsubscribe result: true", script_result); |
| 763 EXPECT_NE(push_service(), GetAppHandler()); | |
| 764 | |
| 765 // After unsubscribing, subscribe again from the worker with no key. | |
| 766 // The sender id should again be read from the datastore, so the | |
| 767 // subcribe should succeed, and we should get a new subscription token. | |
| 768 ASSERT_TRUE(RunScript("workerSubscribePushNoKey()", &script_result)); | |
| 769 std::string token3; | |
| 770 ASSERT_NO_FATAL_FAILURE( | |
| 771 EndpointToToken(script_result, false /* standard_protocol */, &token3)); | |
| 772 EXPECT_NE(token1, token3); | |
| 773 | |
| 774 ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); | |
| 775 EXPECT_EQ("unsubscribe result: true", script_result); | |
| 776 EXPECT_NE(push_service(), GetAppHandler()); | |
| 777 } | |
| 778 | |
| 779 IN_PROC_BROWSER_TEST_F( | |
| 780 PushMessagingBrowserTest, | |
| 781 ResubscribeWithoutKeyAfterSubscribingFromWorkerWithNumber) { | |
| 782 std::string script_result; | |
| 783 | |
| 784 ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result)); | |
| 785 ASSERT_EQ("ok - service worker registered", script_result); | |
| 786 | |
| 787 ASSERT_NO_FATAL_FAILURE(RequestAndAcceptPermission()); | |
| 788 | |
| 789 LoadTestPageWithoutManifest(); // Reload to become controlled. | |
| 790 | |
| 791 ASSERT_TRUE(RunScript("isControlled()", &script_result)); | |
| 792 ASSERT_EQ("true - is controlled", script_result); | |
| 793 | |
| 794 // Run the subscribe from the service worker with a numeric key. | |
| 795 // This should succeed. | |
| 796 ASSERT_TRUE(RunScript("workerSubscribePushWithNumericKey()", &script_result)); | |
| 797 std::string token1; | |
| 798 ASSERT_NO_FATAL_FAILURE( | |
| 799 EndpointToToken(script_result, false /* standard_protocol */, &token1)); | |
| 800 | |
| 801 // Try to resubscribe from the document without a key - should fail. | |
| 802 ASSERT_TRUE(RunScript("documentSubscribePushWithoutKey()", &script_result)); | |
| 803 EXPECT_EQ( | |
| 804 "AbortError - Registration failed - missing applicationServerKey, " | |
| 805 "and manifest empty or missing", | |
| 806 script_result); | |
| 807 | |
| 808 // Now run the subscribe from the service worker without a key. | |
| 809 // In this case, the sender id should be read from the datastore. | |
| 810 // Note, we would rather this failed as we only really want to support | |
| 811 // no-key subscribes after subscribing with a numeric gcm sender id in the | |
| 812 // manifest, not a numeric applicationServerKey, but for code simplicity | |
| 813 // this case is allowed. | |
| 814 ASSERT_TRUE(RunScript("workerSubscribePushNoKey()", &script_result)); | |
| 815 std::string token2; | |
| 816 ASSERT_NO_FATAL_FAILURE( | |
| 817 EndpointToToken(script_result, false /* standard_protocol */, &token2)); | |
| 818 EXPECT_EQ(token1, token2); | |
| 819 | |
| 820 ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); | |
| 821 EXPECT_EQ("unsubscribe result: true", script_result); | |
| 822 EXPECT_NE(push_service(), GetAppHandler()); | |
| 823 | |
| 824 // After unsubscribing, subscribe again from the worker with no key. | |
| 825 // The sender id should again be read from the datastore, so the | |
| 826 // subcribe should succeed, and we should get a new subscription token. | |
| 827 ASSERT_TRUE(RunScript("workerSubscribePushNoKey()", &script_result)); | |
| 828 std::string token3; | |
| 829 ASSERT_NO_FATAL_FAILURE( | |
| 830 EndpointToToken(script_result, false /* standard_protocol */, &token3)); | |
| 831 EXPECT_NE(token1, token3); | |
| 832 | |
| 833 ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); | |
| 834 EXPECT_EQ("unsubscribe result: true", script_result); | |
| 835 EXPECT_NE(push_service(), GetAppHandler()); | 615 EXPECT_NE(push_service(), GetAppHandler()); |
| 836 } | 616 } |
| 837 | 617 |
| 838 // Disabled on Windows and Linux due to flakiness (http://crbug.com/554003). | 618 // Disabled on Windows and Linux due to flakiness (http://crbug.com/554003). |
| 839 #if defined(OS_WIN) || defined(OS_LINUX) | 619 #if defined(OS_WIN) || defined(OS_LINUX) |
| 840 #define MAYBE_SubscribePersisted DISABLED_SubscribePersisted | 620 #define MAYBE_SubscribePersisted DISABLED_SubscribePersisted |
| 841 #else | 621 #else |
| 842 #define MAYBE_SubscribePersisted SubscribePersisted | 622 #define MAYBE_SubscribePersisted SubscribePersisted |
| 843 #endif | 623 #endif |
| 844 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, MAYBE_SubscribePersisted) { | 624 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, MAYBE_SubscribePersisted) { |
| (...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2104 ASSERT_NO_FATAL_FAILURE(SubscribeSuccessfully()); | 1884 ASSERT_NO_FATAL_FAILURE(SubscribeSuccessfully()); |
| 2105 ASSERT_FALSE(background_mode_manager->IsBackgroundModeActive()); | 1885 ASSERT_FALSE(background_mode_manager->IsBackgroundModeActive()); |
| 2106 | 1886 |
| 2107 // After dropping the last subscription background mode is still inactive. | 1887 // After dropping the last subscription background mode is still inactive. |
| 2108 std::string script_result; | 1888 std::string script_result; |
| 2109 ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); | 1889 ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); |
| 2110 EXPECT_EQ("unsubscribe result: true", script_result); | 1890 EXPECT_EQ("unsubscribe result: true", script_result); |
| 2111 ASSERT_FALSE(background_mode_manager->IsBackgroundModeActive()); | 1891 ASSERT_FALSE(background_mode_manager->IsBackgroundModeActive()); |
| 2112 } | 1892 } |
| 2113 #endif // BUILDFLAG(ENABLE_BACKGROUND) && !defined(OS_CHROMEOS) | 1893 #endif // BUILDFLAG(ENABLE_BACKGROUND) && !defined(OS_CHROMEOS) |
| OLD | NEW |