OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/scoped_temp_dir.h" | 6 #include "base/scoped_temp_dir.h" |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/intents/web_intents_registry.h" | 8 #include "chrome/browser/intents/web_intents_registry.h" |
9 #include "chrome/browser/webdata/web_data_service.h" | 9 #include "chrome/browser/webdata/web_data_service.h" |
10 #include "chrome/test/base/testing_browser_process_test.h" | 10 #include "chrome/test/base/testing_browser_process_test.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 | 95 |
96 intent.action = ASCIIToUTF16("share"); | 96 intent.action = ASCIIToUTF16("share"); |
97 intent.type = ASCIIToUTF16("image/*"); | 97 intent.type = ASCIIToUTF16("image/*"); |
98 registry_.UnregisterIntentProvider(intent); | 98 registry_.UnregisterIntentProvider(intent); |
99 | 99 |
100 consumer.expected_id_ = registry_.GetIntentProviders(ASCIIToUTF16("share"), | 100 consumer.expected_id_ = registry_.GetIntentProviders(ASCIIToUTF16("share"), |
101 &consumer); | 101 &consumer); |
102 consumer.WaitForData(); | 102 consumer.WaitForData(); |
103 EXPECT_EQ(1U, consumer.intents_.size()); | 103 EXPECT_EQ(1U, consumer.intents_.size()); |
104 } | 104 } |
105 | |
106 TEST_F(WebIntentsRegistryTest, GetAllIntents) { | |
107 WebIntentData intent; | |
108 intent.service_url = GURL("http://google.com"); | |
109 intent.action = ASCIIToUTF16("share"); | |
110 intent.type = ASCIIToUTF16("image/*"); | |
111 intent.title = ASCIIToUTF16("Google's Sharing Service"); | |
112 | |
113 registry_.RegisterIntentProvider(intent); | |
114 | |
115 intent.action = ASCIIToUTF16("search"); | |
116 | |
Greg Billock
2011/08/12 17:34:25
Need another "RegisterIntentProvider" here?
| |
117 TestConsumer consumer; | |
118 consumer.expected_id_ = registry_.GetAllIntentProviders(&consumer); | |
119 consumer.WaitForData(); | |
120 EXPECT_EQ(2U, consumer.intents_.size()); | |
Greg Billock
2011/08/12 17:34:25
Looks like it should be ASSERT
groby-ooo-7-16
2011/08/12 19:51:38
Done.
| |
121 | |
122 if (consumer.intents_[0].action != ASCIIToUTF16("share")) | |
123 std::swap(consumer.intents_[0],consumer.intents_[1]); | |
124 | |
125 EXPECT_EQ(intent, consumer.intents_[0]); | |
126 | |
127 intent.action = ASCIIToUTF16("search"); | |
128 EXPECT_EQ(intent, consumer.intents_[1]); | |
129 } | |
OLD | NEW |