Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: chrome/browser/intents/web_intents_registry_unittest.cc

Issue 10824212: Add support for unregistering web intents default by service_url. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Do test setup verification prior to verifying remove/unregister support. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/json/json_file_value_serializer.h" 7 #include "base/json/json_file_value_serializer.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/scoped_temp_dir.h" 10 #include "base/scoped_temp_dir.h"
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 ServiceListConsumer consumer; 727 ServiceListConsumer consumer;
728 registry_.GetIntentServices(ASCIIToUTF16("http://webintents.org/share"), 728 registry_.GetIntentServices(ASCIIToUTF16("http://webintents.org/share"),
729 ASCIIToUTF16("image/*"), 729 ASCIIToUTF16("image/*"),
730 base::Bind(&ServiceListConsumer::Accept, 730 base::Bind(&ServiceListConsumer::Accept,
731 base::Unretained(&consumer))); 731 base::Unretained(&consumer)));
732 732
733 consumer.WaitForData(); 733 consumer.WaitForData();
734 ASSERT_EQ(1U, consumer.services_.size()); 734 ASSERT_EQ(1U, consumer.services_.size());
735 EXPECT_EQ(ASCIIToUTF16("image/png,image/jpg"), consumer.services_[0].type); 735 EXPECT_EQ(ASCIIToUTF16("image/png,image/jpg"), consumer.services_[0].type);
736 } 736 }
737
738 TEST_F(WebIntentsRegistryTest, UnregisterDefaultIntentServicesForServiceURL) {
James Hawkins 2012/08/08 16:22:37 nit: Document what this method is testing. I'd re
Steve McKay 2012/08/08 17:54:42 Revised method name, leaving this method name as-i
739
James Hawkins 2012/08/08 16:22:37 nit: Remove blank line.
Steve McKay 2012/08/08 17:54:42 Done.
740 const GURL service_url_0("http://jibfest.com/dozer");
741 const GURL service_url_1("http://kittyfizzer.com/fizz");
742
743 DefaultWebIntentService s0;
744 s0.action = ASCIIToUTF16("share");
745 s0.type = ASCIIToUTF16("text/*");
746 // Values here are just dummies to test for preservation.
747 s0.user_date = 1;
748 s0.suppression = 4;
749 s0.service_url = service_url_0.spec();
750 registry_.RegisterDefaultIntentService(s0);
751
752 DefaultWebIntentService s1;
753 s1.action = ASCIIToUTF16("whack");
754 s1.type = ASCIIToUTF16("text/*");
755 // Values here are just dummies to test for preservation.
756 s1.user_date = 1;
757 s1.suppression = 4;
758 s1.service_url = service_url_1.spec();
759 registry_.RegisterDefaultIntentService(s1);
760
761 DefaultServiceListConsumer consumer;
762
763 // Test we can retrieve default entries by action.
James Hawkins 2012/08/08 16:22:37 nit: Reword to remove pronoun.
Steve McKay 2012/08/08 17:54:42 Nuked the invalid comment.
764 registry_.GetAllDefaultIntentServices(
765 base::Bind(&DefaultServiceListConsumer::Accept,
766 base::Unretained(&consumer)));
767
768 consumer.WaitForData();
769
770 ASSERT_EQ(2U, consumer.services_.size());
771
772 registry_.UnregisterDefaultIntentServicesForServiceURL(service_url_0);
773 MessageLoop::current()->RunAllPending();
774
775 // Test we can retrieve default entries by action.
Steve McKay 2012/08/08 17:54:42 Nuked this too.
776 registry_.GetAllDefaultIntentServices(
777 base::Bind(&DefaultServiceListConsumer::Accept,
778 base::Unretained(&consumer)));
779
780 consumer.WaitForData();
781
782 ASSERT_EQ(1U, consumer.services_.size());
783 EXPECT_EQ(service_url_1.spec(), consumer.services_[0].service_url);
784 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698