OLD | NEW |
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 "chrome/browser/extensions/extension_browsertest.h" | 5 #include "chrome/browser/extensions/extension_browsertest.h" |
6 #include "chrome/browser/ui/browser.h" | 6 #include "chrome/browser/ui/browser.h" |
7 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 7 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
8 #include "chrome/common/url_constants.h" | 8 #include "chrome/common/url_constants.h" |
9 #include "chrome/test/base/ui_test_utils.h" | 9 #include "chrome/test/base/ui_test_utils.h" |
10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
11 #include "content/public/test/browser_test_utils.h" | 11 #include "content/public/test/browser_test_utils.h" |
12 #include "extensions/common/constants.h" | 12 #include "extensions/common/constants.h" |
13 #include "extensions/common/extension.h" | 13 #include "extensions/common/extension.h" |
14 | 14 |
15 using content::WebContents; | 15 using content::WebContents; |
16 using extensions::Extension; | 16 using extensions::Extension; |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 const char kSubscribePage[] = "/subscribe.html"; | 20 const char kSubscribePage[] = "/subscribe.html"; |
21 const char kFeedPageMultiRel[] = "files/feeds/feed_multi_rel.html"; | 21 const char kFeedPageMultiRel[] = "/feeds/feed_multi_rel.html"; |
22 const char kValidFeedNoLinks[] = "files/feeds/feed_nolinks.xml"; | 22 const char kValidFeedNoLinks[] = "/feeds/feed_nolinks.xml"; |
23 const char kValidFeed0[] = "files/feeds/feed_script.xml"; | 23 const char kValidFeed0[] = "/feeds/feed_script.xml"; |
24 const char kValidFeed1[] = "files/feeds/feed1.xml"; | 24 const char kValidFeed1[] = "/feeds/feed1.xml"; |
25 const char kValidFeed2[] = "files/feeds/feed2.xml"; | 25 const char kValidFeed2[] = "/feeds/feed2.xml"; |
26 const char kValidFeed3[] = "files/feeds/feed3.xml"; | 26 const char kValidFeed3[] = "/feeds/feed3.xml"; |
27 const char kValidFeed4[] = "files/feeds/feed4.xml"; | 27 const char kValidFeed4[] = "/feeds/feed4.xml"; |
28 const char kValidFeed5[] = "files/feeds/feed5.xml"; | 28 const char kValidFeed5[] = "/feeds/feed5.xml"; |
29 const char kValidFeed6[] = "files/feeds/feed6.xml"; | 29 const char kValidFeed6[] = "/feeds/feed6.xml"; |
30 const char kInvalidFeed1[] = "files/feeds/feed_invalid1.xml"; | 30 const char kInvalidFeed1[] = "/feeds/feed_invalid1.xml"; |
31 const char kInvalidFeed2[] = "files/feeds/feed_invalid2.xml"; | 31 const char kInvalidFeed2[] = "/feeds/feed_invalid2.xml"; |
32 // We need a triple encoded string to prove that we are not decoding twice in | 32 // We need a triple encoded string to prove that we are not decoding twice in |
33 // subscribe.js because one layer is also stripped off when subscribe.js passes | 33 // subscribe.js because one layer is also stripped off when subscribe.js passes |
34 // it to the XMLHttpRequest object. | 34 // it to the XMLHttpRequest object. |
35 const char kFeedTripleEncoded[] = "files/feeds/url%25255Fdecoding.html"; | 35 const char kFeedTripleEncoded[] = "/feeds/url%25255Fdecoding.html"; |
36 | 36 |
37 static const char kScriptFeedTitle[] = | 37 static const char kScriptFeedTitle[] = |
38 "window.domAutomationController.send(" | 38 "window.domAutomationController.send(" |
39 " document.getElementById('title') ? " | 39 " document.getElementById('title') ? " |
40 " document.getElementById('title').textContent : " | 40 " document.getElementById('title').textContent : " |
41 " \"element 'title' not found\"" | 41 " \"element 'title' not found\"" |
42 ");"; | 42 ");"; |
43 static const char kScriptAnchor[] = | 43 static const char kScriptAnchor[] = |
44 "window.domAutomationController.send(" | 44 "window.domAutomationController.send(" |
45 " document.getElementById('anchor_0') ? " | 45 " document.getElementById('anchor_0') ? " |
46 " document.getElementById('anchor_0').textContent : " | 46 " document.getElementById('anchor_0').textContent : " |
47 " \"element 'anchor_0' not found\"" | 47 " \"element 'anchor_0' not found\"" |
48 ");"; | 48 ");"; |
49 static const char kScriptDesc[] = | 49 static const char kScriptDesc[] = |
50 "window.domAutomationController.send(" | 50 "window.domAutomationController.send(" |
51 " document.getElementById('desc_0') ? " | 51 " document.getElementById('desc_0') ? " |
52 " document.getElementById('desc_0').textContent : " | 52 " document.getElementById('desc_0').textContent : " |
53 " \"element 'desc_0' not found\"" | 53 " \"element 'desc_0' not found\"" |
54 ");"; | 54 ");"; |
55 static const char kScriptError[] = | 55 static const char kScriptError[] = |
56 "window.domAutomationController.send(" | 56 "window.domAutomationController.send(" |
57 " document.getElementById('error') ? " | 57 " document.getElementById('error') ? " |
58 " document.getElementById('error').textContent : " | 58 " document.getElementById('error').textContent : " |
59 " \"No error\"" | 59 " \"No error\"" |
60 ");"; | 60 ");"; |
61 | 61 |
62 GURL GetFeedUrl(net::SpawnedTestServer* server, const std::string& feed_page, | 62 GURL GetFeedUrl(net::EmbeddedTestServer* server, |
63 bool direct_url, std::string extension_id) { | 63 const std::string& feed_page, |
| 64 bool direct_url, |
| 65 std::string extension_id) { |
64 GURL feed_url = server->GetURL(feed_page); | 66 GURL feed_url = server->GetURL(feed_page); |
65 if (direct_url) { | 67 if (direct_url) { |
66 // We navigate directly to the subscribe page for feeds where the feed | 68 // We navigate directly to the subscribe page for feeds where the feed |
67 // sniffing won't work, in other words, as is the case for malformed feeds. | 69 // sniffing won't work, in other words, as is the case for malformed feeds. |
68 return GURL(std::string(extensions::kExtensionScheme) + | 70 return GURL(std::string(extensions::kExtensionScheme) + |
69 url::kStandardSchemeSeparator + | 71 url::kStandardSchemeSeparator + |
70 extension_id + std::string(kSubscribePage) + std::string("?") + | 72 extension_id + std::string(kSubscribePage) + std::string("?") + |
71 feed_url.spec() + std::string("&synchronous")); | 73 feed_url.spec() + std::string("&synchronous")); |
72 } else { | 74 } else { |
73 // Navigate to the feed content (which will cause the extension to try to | 75 // Navigate to the feed content (which will cause the extension to try to |
(...skipping 13 matching lines...) Expand all Loading... |
87 return false; | 89 return false; |
88 | 90 |
89 EXPECT_STREQ(expected_value.c_str(), returned_value.c_str()); | 91 EXPECT_STREQ(expected_value.c_str(), returned_value.c_str()); |
90 return expected_value == returned_value; | 92 return expected_value == returned_value; |
91 } | 93 } |
92 | 94 |
93 // Navigates to a feed page and, if |sniff_xml_type| is set, wait for the | 95 // Navigates to a feed page and, if |sniff_xml_type| is set, wait for the |
94 // extension to kick in, detect the feed and redirect to a feed preview page. | 96 // extension to kick in, detect the feed and redirect to a feed preview page. |
95 // |sniff_xml_type| is generally set to true if the feed is sniffable and false | 97 // |sniff_xml_type| is generally set to true if the feed is sniffable and false |
96 // for invalid feeds. | 98 // for invalid feeds. |
97 void NavigateToFeedAndValidate(net::SpawnedTestServer* server, | 99 void NavigateToFeedAndValidate(net::EmbeddedTestServer* server, |
98 const std::string& url, | 100 const std::string& url, |
99 Browser* browser, | 101 Browser* browser, |
100 std::string extension_id, | 102 std::string extension_id, |
101 bool sniff_xml_type, | 103 bool sniff_xml_type, |
102 const std::string& expected_feed_title, | 104 const std::string& expected_feed_title, |
103 const std::string& expected_item_title, | 105 const std::string& expected_item_title, |
104 const std::string& expected_item_desc, | 106 const std::string& expected_item_desc, |
105 const std::string& expected_error) { | 107 const std::string& expected_error) { |
106 if (sniff_xml_type) { | 108 if (sniff_xml_type) { |
107 // TODO(finnur): Implement this is a non-flaky way. | 109 // TODO(finnur): Implement this is a non-flaky way. |
(...skipping 11 matching lines...) Expand all Loading... |
119 ASSERT_TRUE(ValidatePageElement(frame, kScriptAnchor, expected_item_title)); | 121 ASSERT_TRUE(ValidatePageElement(frame, kScriptAnchor, expected_item_title)); |
120 ASSERT_TRUE(ValidatePageElement(frame, kScriptDesc, expected_item_desc)); | 122 ASSERT_TRUE(ValidatePageElement(frame, kScriptDesc, expected_item_desc)); |
121 ASSERT_TRUE(ValidatePageElement(frame, kScriptError, expected_error)); | 123 ASSERT_TRUE(ValidatePageElement(frame, kScriptError, expected_error)); |
122 } | 124 } |
123 | 125 |
124 } // namespace | 126 } // namespace |
125 | 127 |
126 // Makes sure that the RSS detects RSS feed links, even when rel tag contains | 128 // Makes sure that the RSS detects RSS feed links, even when rel tag contains |
127 // more than just "alternate". | 129 // more than just "alternate". |
128 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, RSSMultiRelLink) { | 130 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, RSSMultiRelLink) { |
129 ASSERT_TRUE(test_server()->Start()); | 131 ASSERT_TRUE(embedded_test_server()->Start()); |
130 | 132 |
131 ASSERT_TRUE(LoadExtension( | 133 ASSERT_TRUE(LoadExtension( |
132 test_data_dir_.AppendASCII("subscribe_page_action"))); | 134 test_data_dir_.AppendASCII("subscribe_page_action"))); |
133 | 135 |
134 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(0)); | 136 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(0)); |
135 | 137 |
136 // Navigate to the feed page. | 138 // Navigate to the feed page. |
137 GURL feed_url = test_server()->GetURL(kFeedPageMultiRel); | 139 GURL feed_url = embedded_test_server()->GetURL(kFeedPageMultiRel); |
138 ui_test_utils::NavigateToURL(browser(), feed_url); | 140 ui_test_utils::NavigateToURL(browser(), feed_url); |
139 // We should now have one page action ready to go in the LocationBar. | 141 // We should now have one page action ready to go in the LocationBar. |
140 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(1)); | 142 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(1)); |
141 } | 143 } |
142 | 144 |
143 // This test is flaky on all platforms; see http://crbug.com/340354 | 145 // This test is flaky on all platforms; see http://crbug.com/340354 |
144 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, DISABLED_RSSParseFeedValidFeed1) { | 146 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, DISABLED_RSSParseFeedValidFeed1) { |
145 ASSERT_TRUE(test_server()->Start()); | 147 ASSERT_TRUE(embedded_test_server()->Start()); |
146 | 148 |
147 const Extension* extension = LoadExtension( | 149 const Extension* extension = LoadExtension( |
148 test_data_dir_.AppendASCII("subscribe_page_action")); | 150 test_data_dir_.AppendASCII("subscribe_page_action")); |
149 ASSERT_TRUE(extension); | 151 ASSERT_TRUE(extension); |
150 std::string id = extension->id(); | 152 std::string id = extension->id(); |
151 | 153 |
152 NavigateToFeedAndValidate(test_server(), kValidFeed1, browser(), id, true, | 154 NavigateToFeedAndValidate(embedded_test_server(), kValidFeed1, browser(), id, |
153 "Feed for MyFeedTitle", | 155 true, "Feed for MyFeedTitle", "Title 1", "Desc", |
154 "Title 1", | |
155 "Desc", | |
156 "No error"); | 156 "No error"); |
157 } | 157 } |
158 | 158 |
159 // This test is flaky on all platforms; see http://crbug.com/340354 | 159 // This test is flaky on all platforms; see http://crbug.com/340354 |
160 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, DISABLED_RSSParseFeedValidFeed2) { | 160 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, DISABLED_RSSParseFeedValidFeed2) { |
161 ASSERT_TRUE(test_server()->Start()); | 161 ASSERT_TRUE(embedded_test_server()->Start()); |
162 | 162 |
163 const Extension* extension = LoadExtension( | 163 const Extension* extension = LoadExtension( |
164 test_data_dir_.AppendASCII("subscribe_page_action")); | 164 test_data_dir_.AppendASCII("subscribe_page_action")); |
165 ASSERT_TRUE(extension); | 165 ASSERT_TRUE(extension); |
166 std::string id = extension->id(); | 166 std::string id = extension->id(); |
167 | 167 |
168 NavigateToFeedAndValidate(test_server(), kValidFeed2, browser(), id, true, | 168 NavigateToFeedAndValidate(embedded_test_server(), kValidFeed2, browser(), id, |
169 "Feed for MyFeed2", | 169 true, "Feed for MyFeed2", "My item title1", |
170 "My item title1", | 170 "This is a summary.", "No error"); |
171 "This is a summary.", | |
172 "No error"); | |
173 } | 171 } |
174 | 172 |
175 // This test is flaky on all platforms; see http://crbug.com/340354 | 173 // This test is flaky on all platforms; see http://crbug.com/340354 |
176 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, DISABLED_RSSParseFeedValidFeed3) { | 174 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, DISABLED_RSSParseFeedValidFeed3) { |
177 ASSERT_TRUE(test_server()->Start()); | 175 ASSERT_TRUE(embedded_test_server()->Start()); |
178 | 176 |
179 const Extension* extension = LoadExtension( | 177 const Extension* extension = LoadExtension( |
180 test_data_dir_.AppendASCII("subscribe_page_action")); | 178 test_data_dir_.AppendASCII("subscribe_page_action")); |
181 ASSERT_TRUE(extension); | 179 ASSERT_TRUE(extension); |
182 std::string id = extension->id(); | 180 std::string id = extension->id(); |
183 | 181 |
184 NavigateToFeedAndValidate(test_server(), kValidFeed3, browser(), id, true, | 182 NavigateToFeedAndValidate(embedded_test_server(), kValidFeed3, browser(), id, |
185 "Feed for Google Code buglist rss feed", | 183 true, "Feed for Google Code buglist rss feed", |
186 "My dear title", | 184 "My dear title", "My dear content", "No error"); |
187 "My dear content", | |
188 "No error"); | |
189 } | 185 } |
190 | 186 |
191 // This test is flaky on all platforms; see http://crbug.com/340354 | 187 // This test is flaky on all platforms; see http://crbug.com/340354 |
192 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, DISABLED_RSSParseFeedValidFeed4) { | 188 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, DISABLED_RSSParseFeedValidFeed4) { |
193 ASSERT_TRUE(test_server()->Start()); | 189 ASSERT_TRUE(embedded_test_server()->Start()); |
194 | 190 |
195 const Extension* extension = LoadExtension( | 191 const Extension* extension = LoadExtension( |
196 test_data_dir_.AppendASCII("subscribe_page_action")); | 192 test_data_dir_.AppendASCII("subscribe_page_action")); |
197 ASSERT_TRUE(extension); | 193 ASSERT_TRUE(extension); |
198 std::string id = extension->id(); | 194 std::string id = extension->id(); |
199 | 195 |
200 NavigateToFeedAndValidate(test_server(), kValidFeed4, browser(), id, true, | 196 NavigateToFeedAndValidate(embedded_test_server(), kValidFeed4, browser(), id, |
201 "Feed for Title chars <script> %23 stop", | 197 true, "Feed for Title chars <script> %23 stop", |
202 "Title chars %23 stop", | 198 "Title chars %23 stop", "My dear content %23 stop", |
203 "My dear content %23 stop", | |
204 "No error"); | 199 "No error"); |
205 } | 200 } |
206 | 201 |
207 // This test is flaky on all platforms; see http://crbug.com/340354 | 202 // This test is flaky on all platforms; see http://crbug.com/340354 |
208 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, DISABLED_RSSParseFeedValidFeed0) { | 203 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, DISABLED_RSSParseFeedValidFeed0) { |
209 ASSERT_TRUE(test_server()->Start()); | 204 ASSERT_TRUE(embedded_test_server()->Start()); |
210 | 205 |
211 const Extension* extension = LoadExtension( | 206 const Extension* extension = LoadExtension( |
212 test_data_dir_.AppendASCII("subscribe_page_action")); | 207 test_data_dir_.AppendASCII("subscribe_page_action")); |
213 ASSERT_TRUE(extension); | 208 ASSERT_TRUE(extension); |
214 std::string id = extension->id(); | 209 std::string id = extension->id(); |
215 | 210 |
216 // Try a feed with a link with an onclick handler (before r27440 this would | 211 // Try a feed with a link with an onclick handler (before r27440 this would |
217 // trigger a NOTREACHED). | 212 // trigger a NOTREACHED). |
218 NavigateToFeedAndValidate(test_server(), kValidFeed0, browser(), id, true, | 213 NavigateToFeedAndValidate(embedded_test_server(), kValidFeed0, browser(), id, |
219 "Feed for MyFeedTitle", | 214 true, "Feed for MyFeedTitle", "Title 1", |
220 "Title 1", | 215 "Desc VIDEO", "No error"); |
221 "Desc VIDEO", | |
222 "No error"); | |
223 } | 216 } |
224 | 217 |
225 // This test is flaky on all platforms; see http://crbug.com/340354 | 218 // This test is flaky on all platforms; see http://crbug.com/340354 |
226 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, DISABLED_RSSParseFeedValidFeed5) { | 219 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, DISABLED_RSSParseFeedValidFeed5) { |
227 ASSERT_TRUE(test_server()->Start()); | 220 ASSERT_TRUE(embedded_test_server()->Start()); |
228 | 221 |
229 const Extension* extension = LoadExtension( | 222 const Extension* extension = LoadExtension( |
230 test_data_dir_.AppendASCII("subscribe_page_action")); | 223 test_data_dir_.AppendASCII("subscribe_page_action")); |
231 ASSERT_TRUE(extension); | 224 ASSERT_TRUE(extension); |
232 std::string id = extension->id(); | 225 std::string id = extension->id(); |
233 | 226 |
234 // Feed with valid but mostly empty xml. | 227 // Feed with valid but mostly empty xml. |
235 NavigateToFeedAndValidate(test_server(), kValidFeed5, browser(), id, true, | 228 NavigateToFeedAndValidate( |
236 "Feed for Unknown feed name", | 229 embedded_test_server(), kValidFeed5, browser(), id, true, |
237 "element 'anchor_0' not found", | 230 "Feed for Unknown feed name", "element 'anchor_0' not found", |
238 "element 'desc_0' not found", | 231 "element 'desc_0' not found", "This feed contains no entries."); |
239 "This feed contains no entries."); | |
240 } | 232 } |
241 | 233 |
242 // This test is flaky on all platforms; see http://crbug.com/340354 | 234 // This test is flaky on all platforms; see http://crbug.com/340354 |
243 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, DISABLED_RSSParseFeedValidFeed6) { | 235 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, DISABLED_RSSParseFeedValidFeed6) { |
244 ASSERT_TRUE(test_server()->Start()); | 236 ASSERT_TRUE(embedded_test_server()->Start()); |
245 | 237 |
246 const Extension* extension = LoadExtension( | 238 const Extension* extension = LoadExtension( |
247 test_data_dir_.AppendASCII("subscribe_page_action")); | 239 test_data_dir_.AppendASCII("subscribe_page_action")); |
248 ASSERT_TRUE(extension); | 240 ASSERT_TRUE(extension); |
249 std::string id = extension->id(); | 241 std::string id = extension->id(); |
250 | 242 |
251 // Feed that is technically invalid but still parseable. | 243 // Feed that is technically invalid but still parseable. |
252 NavigateToFeedAndValidate(test_server(), kValidFeed6, browser(), id, true, | 244 NavigateToFeedAndValidate(embedded_test_server(), kValidFeed6, browser(), id, |
253 "Feed for MyFeedTitle", | 245 true, "Feed for MyFeedTitle", "Title 1", "Desc", |
254 "Title 1", | |
255 "Desc", | |
256 "No error"); | 246 "No error"); |
257 } | 247 } |
258 | 248 |
259 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, RSSParseFeedInvalidFeed1) { | 249 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, RSSParseFeedInvalidFeed1) { |
260 ASSERT_TRUE(test_server()->Start()); | 250 ASSERT_TRUE(embedded_test_server()->Start()); |
261 | 251 |
262 const Extension* extension = LoadExtension( | 252 const Extension* extension = LoadExtension( |
263 test_data_dir_.AppendASCII("subscribe_page_action")); | 253 test_data_dir_.AppendASCII("subscribe_page_action")); |
264 ASSERT_TRUE(extension); | 254 ASSERT_TRUE(extension); |
265 std::string id = extension->id(); | 255 std::string id = extension->id(); |
266 | 256 |
267 // Try an empty feed. | 257 // Try an empty feed. |
268 NavigateToFeedAndValidate(test_server(), kInvalidFeed1, browser(), id, false, | 258 NavigateToFeedAndValidate( |
269 "Feed for Unknown feed name", | 259 embedded_test_server(), kInvalidFeed1, browser(), id, false, |
270 "element 'anchor_0' not found", | 260 "Feed for Unknown feed name", "element 'anchor_0' not found", |
271 "element 'desc_0' not found", | 261 "element 'desc_0' not found", "This feed contains no entries."); |
272 "This feed contains no entries."); | |
273 } | 262 } |
274 | 263 |
275 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, RSSParseFeedInvalidFeed2) { | 264 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, RSSParseFeedInvalidFeed2) { |
276 ASSERT_TRUE(test_server()->Start()); | 265 ASSERT_TRUE(embedded_test_server()->Start()); |
277 | 266 |
278 const Extension* extension = LoadExtension( | 267 const Extension* extension = LoadExtension( |
279 test_data_dir_.AppendASCII("subscribe_page_action")); | 268 test_data_dir_.AppendASCII("subscribe_page_action")); |
280 ASSERT_TRUE(extension); | 269 ASSERT_TRUE(extension); |
281 std::string id = extension->id(); | 270 std::string id = extension->id(); |
282 | 271 |
283 // Try a garbage feed. | 272 // Try a garbage feed. |
284 NavigateToFeedAndValidate(test_server(), kInvalidFeed2, browser(), id, false, | 273 NavigateToFeedAndValidate( |
285 "Feed for Unknown feed name", | 274 embedded_test_server(), kInvalidFeed2, browser(), id, false, |
286 "element 'anchor_0' not found", | 275 "Feed for Unknown feed name", "element 'anchor_0' not found", |
287 "element 'desc_0' not found", | 276 "element 'desc_0' not found", "This feed contains no entries."); |
288 "This feed contains no entries."); | |
289 } | 277 } |
290 | 278 |
291 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, RSSParseFeedInvalidFeed3) { | 279 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, RSSParseFeedInvalidFeed3) { |
292 ASSERT_TRUE(test_server()->Start()); | 280 ASSERT_TRUE(embedded_test_server()->Start()); |
293 | 281 |
294 const Extension* extension = LoadExtension( | 282 const Extension* extension = LoadExtension( |
295 test_data_dir_.AppendASCII("subscribe_page_action")); | 283 test_data_dir_.AppendASCII("subscribe_page_action")); |
296 ASSERT_TRUE(extension); | 284 ASSERT_TRUE(extension); |
297 std::string id = extension->id(); | 285 std::string id = extension->id(); |
298 | 286 |
299 // Try a feed that doesn't exist. | 287 // Try a feed that doesn't exist. |
300 NavigateToFeedAndValidate(test_server(), "foo.xml", browser(), id, false, | 288 NavigateToFeedAndValidate( |
301 "Feed for Unknown feed name", | 289 embedded_test_server(), "/foo.xml", browser(), id, false, |
302 "element 'anchor_0' not found", | 290 "Feed for Unknown feed name", "element 'anchor_0' not found", |
303 "element 'desc_0' not found", | 291 "element 'desc_0' not found", "This feed contains no entries."); |
304 "This feed contains no entries."); | |
305 } | 292 } |
306 | 293 |
307 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, RSSParseFeedInvalidFeed4) { | 294 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, RSSParseFeedInvalidFeed4) { |
308 ASSERT_TRUE(test_server()->Start()); | 295 ASSERT_TRUE(embedded_test_server()->Start()); |
309 | 296 |
310 const Extension* extension = LoadExtension( | 297 const Extension* extension = LoadExtension( |
311 test_data_dir_.AppendASCII("subscribe_page_action")); | 298 test_data_dir_.AppendASCII("subscribe_page_action")); |
312 ASSERT_TRUE(extension); | 299 ASSERT_TRUE(extension); |
313 std::string id = extension->id(); | 300 std::string id = extension->id(); |
314 | 301 |
315 // subscribe.js shouldn't double-decode the URL passed in. Otherwise feed | 302 // subscribe.js shouldn't double-decode the URL passed in. Otherwise feed |
316 // links such as http://search.twitter.com/search.atom?lang=en&q=%23chrome | 303 // links such as http://search.twitter.com/search.atom?lang=en&q=%23chrome |
317 // will result in no feed being downloaded because %23 gets decoded to # and | 304 // will result in no feed being downloaded because %23 gets decoded to # and |
318 // therefore #chrome is not treated as part of the Twitter query. This test | 305 // therefore #chrome is not treated as part of the Twitter query. This test |
319 // uses an underscore instead of a hash, but the principle is the same. If | 306 // uses an underscore instead of a hash, but the principle is the same. If |
320 // we start erroneously double decoding again, the path (and the feed) will | 307 // we start erroneously double decoding again, the path (and the feed) will |
321 // become valid resulting in a failure for this test. | 308 // become valid resulting in a failure for this test. |
322 NavigateToFeedAndValidate( | 309 NavigateToFeedAndValidate( |
323 test_server(), kFeedTripleEncoded, browser(), id, true, | 310 embedded_test_server(), kFeedTripleEncoded, browser(), id, true, |
324 "Feed for Unknown feed name", | 311 "Feed for Unknown feed name", "element 'anchor_0' not found", |
325 "element 'anchor_0' not found", | 312 "element 'desc_0' not found", "This feed contains no entries."); |
326 "element 'desc_0' not found", | |
327 "This feed contains no entries."); | |
328 } | 313 } |
329 | 314 |
330 // This test is flaky on all platforms; see http://crbug.com/340354 | 315 // This test is flaky on all platforms; see http://crbug.com/340354 |
331 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, | 316 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, |
332 DISABLED_RSSParseFeedValidFeedNoLinks) { | 317 DISABLED_RSSParseFeedValidFeedNoLinks) { |
333 ASSERT_TRUE(test_server()->Start()); | 318 ASSERT_TRUE(embedded_test_server()->Start()); |
334 | 319 |
335 const Extension* extension = LoadExtension( | 320 const Extension* extension = LoadExtension( |
336 test_data_dir_.AppendASCII("subscribe_page_action")); | 321 test_data_dir_.AppendASCII("subscribe_page_action")); |
337 ASSERT_TRUE(extension); | 322 ASSERT_TRUE(extension); |
338 std::string id = extension->id(); | 323 std::string id = extension->id(); |
339 | 324 |
340 // Valid feed but containing no links. | 325 // Valid feed but containing no links. |
341 NavigateToFeedAndValidate( | 326 NavigateToFeedAndValidate(embedded_test_server(), kValidFeedNoLinks, |
342 test_server(), kValidFeedNoLinks, browser(), id, true, | 327 browser(), id, true, "Feed for MyFeedTitle", |
343 "Feed for MyFeedTitle", | 328 "Title with no link", "Desc", "No error"); |
344 "Title with no link", | |
345 "Desc", | |
346 "No error"); | |
347 } | 329 } |
OLD | NEW |