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

Side by Side Diff: chrome/browser/extensions/subscribe_page_action_browsertest.cc

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

Powered by Google App Engine
This is Rietveld 408576698