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/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/extensions/autoupdate_interceptor.h" | 8 #include "chrome/browser/extensions/autoupdate_interceptor.h" |
9 #include "chrome/browser/extensions/extension_apitest.h" | 9 #include "chrome/browser/extensions/extension_apitest.h" |
10 #include "chrome/browser/extensions/extension_browsertest.h" | 10 #include "chrome/browser/extensions/extension_browsertest.h" |
11 #include "chrome/browser/extensions/extension_error_reporter.h" | 11 #include "chrome/browser/extensions/extension_error_reporter.h" |
12 #include "chrome/browser/extensions/extension_host.h" | 12 #include "chrome/browser/extensions/extension_host.h" |
13 #include "chrome/browser/extensions/extension_process_manager.h" | 13 #include "chrome/browser/extensions/extension_process_manager.h" |
14 #include "chrome/browser/extensions/extension_service.h" | 14 #include "chrome/browser/extensions/extension_service.h" |
15 #include "chrome/browser/extensions/extension_tab_util.h" | 15 #include "chrome/browser/extensions/extension_tab_util.h" |
16 #include "chrome/browser/extensions/extension_updater.h" | 16 #include "chrome/browser/extensions/extension_updater.h" |
17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/browser/tabs/tab_strip_model.h" | 18 #include "chrome/browser/tabs/tab_strip_model.h" |
19 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
20 #include "chrome/browser/ui/browser_list.h" | 20 #include "chrome/browser/ui/browser_list.h" |
21 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 21 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
22 #include "chrome/common/chrome_paths.h" | 22 #include "chrome/common/chrome_paths.h" |
| 23 #include "chrome/common/chrome_switches.h" |
23 #include "chrome/common/extensions/extension_action.h" | 24 #include "chrome/common/extensions/extension_action.h" |
24 #include "chrome/common/url_constants.h" | 25 #include "chrome/common/url_constants.h" |
25 #include "chrome/test/base/ui_test_utils.h" | 26 #include "chrome/test/base/ui_test_utils.h" |
26 #include "content/browser/renderer_host/render_view_host.h" | 27 #include "content/browser/renderer_host/render_view_host.h" |
27 #include "content/browser/site_instance.h" | 28 #include "content/browser/site_instance.h" |
28 #include "content/browser/tab_contents/tab_contents.h" | 29 #include "content/browser/tab_contents/tab_contents.h" |
29 #include "content/public/browser/notification_service.h" | 30 #include "content/public/browser/notification_service.h" |
30 #include "net/base/net_util.h" | 31 #include "net/base/net_util.h" |
31 #include "net/test/test_server.h" | 32 #include "net/test/test_server.h" |
32 #include "webkit/glue/webpreferences.h" | 33 #include "webkit/glue/webpreferences.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 GetWebkitPrefs(); | 128 GetWebkitPrefs(); |
128 ASSERT_FALSE(prefs.experimental_webgl_enabled); | 129 ASSERT_FALSE(prefs.experimental_webgl_enabled); |
129 ASSERT_FALSE(prefs.accelerated_compositing_enabled); | 130 ASSERT_FALSE(prefs.accelerated_compositing_enabled); |
130 ASSERT_FALSE(prefs.accelerated_2d_canvas_enabled); | 131 ASSERT_FALSE(prefs.accelerated_2d_canvas_enabled); |
131 } | 132 } |
132 | 133 |
133 // Tests that we can load page actions in the Omnibox. | 134 // Tests that we can load page actions in the Omnibox. |
134 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, PageAction) { | 135 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, PageAction) { |
135 ASSERT_TRUE(test_server()->Start()); | 136 ASSERT_TRUE(test_server()->Start()); |
136 | 137 |
| 138 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 139 switches::kAllowLegacyExtensionManifests); |
| 140 |
137 // This page action will not show an icon, since it doesn't specify one but | 141 // This page action will not show an icon, since it doesn't specify one but |
138 // is included here to test for a crash (http://crbug.com/25562). | 142 // is included here to test for a crash (http://crbug.com/25562). |
139 ASSERT_TRUE(LoadExtension( | 143 ASSERT_TRUE(LoadExtension( |
140 test_data_dir_.AppendASCII("browsertest") | 144 test_data_dir_.AppendASCII("browsertest") |
141 .AppendASCII("crash_25562"))); | 145 .AppendASCII("crash_25562"))); |
142 | 146 |
143 ASSERT_TRUE(LoadExtension( | 147 ASSERT_TRUE(LoadExtension( |
144 test_data_dir_.AppendASCII("subscribe_page_action"))); | 148 test_data_dir_.AppendASCII("subscribe_page_action"))); |
145 | 149 |
146 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(0)); | 150 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(0)); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 // Not an in-page navigation, page action should go away. | 184 // Not an in-page navigation, page action should go away. |
181 feed_url = test_server()->GetURL(kHashPageB); | 185 feed_url = test_server()->GetURL(kHashPageB); |
182 ui_test_utils::NavigateToURL(browser(), feed_url); | 186 ui_test_utils::NavigateToURL(browser(), feed_url); |
183 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(0)); | 187 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(0)); |
184 } | 188 } |
185 | 189 |
186 // Tests that the location bar forgets about unloaded page actions. | 190 // Tests that the location bar forgets about unloaded page actions. |
187 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, UnloadPageAction) { | 191 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, UnloadPageAction) { |
188 ASSERT_TRUE(test_server()->Start()); | 192 ASSERT_TRUE(test_server()->Start()); |
189 | 193 |
| 194 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 195 switches::kAllowLegacyExtensionManifests); |
| 196 |
190 FilePath extension_path(test_data_dir_.AppendASCII("subscribe_page_action")); | 197 FilePath extension_path(test_data_dir_.AppendASCII("subscribe_page_action")); |
191 ASSERT_TRUE(LoadExtension(extension_path)); | 198 ASSERT_TRUE(LoadExtension(extension_path)); |
192 | 199 |
193 // Navigation prompts the location bar to load page actions. | 200 // Navigation prompts the location bar to load page actions. |
194 GURL feed_url = test_server()->GetURL(kFeedPage); | 201 GURL feed_url = test_server()->GetURL(kFeedPage); |
195 ui_test_utils::NavigateToURL(browser(), feed_url); | 202 ui_test_utils::NavigateToURL(browser(), feed_url); |
196 ASSERT_TRUE(WaitForPageActionCountChangeTo(1)); | 203 ASSERT_TRUE(WaitForPageActionCountChangeTo(1)); |
197 | 204 |
198 UnloadExtension(last_loaded_extension_id_); | 205 UnloadExtension(last_loaded_extension_id_); |
199 | 206 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 LOG(INFO) << "Test completed : " | 260 LOG(INFO) << "Test completed : " |
254 << (base::TimeTicks::Now() - start_time).InMilliseconds() | 261 << (base::TimeTicks::Now() - start_time).InMilliseconds() |
255 << " ms" << std::flush; | 262 << " ms" << std::flush; |
256 } | 263 } |
257 | 264 |
258 // Makes sure that the RSS detects RSS feed links, even when rel tag contains | 265 // Makes sure that the RSS detects RSS feed links, even when rel tag contains |
259 // more than just "alternate". | 266 // more than just "alternate". |
260 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, RSSMultiRelLink) { | 267 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, RSSMultiRelLink) { |
261 ASSERT_TRUE(test_server()->Start()); | 268 ASSERT_TRUE(test_server()->Start()); |
262 | 269 |
| 270 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 271 switches::kAllowLegacyExtensionManifests); |
| 272 |
263 ASSERT_TRUE(LoadExtension( | 273 ASSERT_TRUE(LoadExtension( |
264 test_data_dir_.AppendASCII("subscribe_page_action"))); | 274 test_data_dir_.AppendASCII("subscribe_page_action"))); |
265 | 275 |
266 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(0)); | 276 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(0)); |
267 | 277 |
268 // Navigate to the feed page. | 278 // Navigate to the feed page. |
269 GURL feed_url = test_server()->GetURL(kFeedPageMultiRel); | 279 GURL feed_url = test_server()->GetURL(kFeedPageMultiRel); |
270 ui_test_utils::NavigateToURL(browser(), feed_url); | 280 ui_test_utils::NavigateToURL(browser(), feed_url); |
271 // We should now have one page action ready to go in the LocationBar. | 281 // We should now have one page action ready to go in the LocationBar. |
272 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(1)); | 282 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(1)); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 expected_item_desc)); | 427 expected_item_desc)); |
418 ASSERT_TRUE(ValidatePageElement(tab, | 428 ASSERT_TRUE(ValidatePageElement(tab, |
419 L"//html/body/div/iframe[1]", | 429 L"//html/body/div/iframe[1]", |
420 jscript_error, | 430 jscript_error, |
421 expected_error)); | 431 expected_error)); |
422 } | 432 } |
423 | 433 |
424 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeed1) { | 434 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeed1) { |
425 ASSERT_TRUE(test_server()->Start()); | 435 ASSERT_TRUE(test_server()->Start()); |
426 | 436 |
| 437 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 438 switches::kAllowLegacyExtensionManifests); |
| 439 |
427 const Extension* extension = LoadExtension( | 440 const Extension* extension = LoadExtension( |
428 test_data_dir_.AppendASCII("subscribe_page_action")); | 441 test_data_dir_.AppendASCII("subscribe_page_action")); |
429 ASSERT_TRUE(extension); | 442 ASSERT_TRUE(extension); |
430 std::string id = extension->id(); | 443 std::string id = extension->id(); |
431 | 444 |
432 NavigateToFeedAndValidate(test_server(), kValidFeed1, browser(), id, true, | 445 NavigateToFeedAndValidate(test_server(), kValidFeed1, browser(), id, true, |
433 "Feed for MyFeedTitle", | 446 "Feed for MyFeedTitle", |
434 "Title 1", | 447 "Title 1", |
435 "Desc", | 448 "Desc", |
436 "No error"); | 449 "No error"); |
437 } | 450 } |
438 | 451 |
439 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeed2) { | 452 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeed2) { |
440 ASSERT_TRUE(test_server()->Start()); | 453 ASSERT_TRUE(test_server()->Start()); |
441 | 454 |
| 455 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 456 switches::kAllowLegacyExtensionManifests); |
| 457 |
442 const Extension* extension = LoadExtension( | 458 const Extension* extension = LoadExtension( |
443 test_data_dir_.AppendASCII("subscribe_page_action")); | 459 test_data_dir_.AppendASCII("subscribe_page_action")); |
444 ASSERT_TRUE(extension); | 460 ASSERT_TRUE(extension); |
445 std::string id = extension->id(); | 461 std::string id = extension->id(); |
446 | 462 |
447 NavigateToFeedAndValidate(test_server(), kValidFeed2, browser(), id, true, | 463 NavigateToFeedAndValidate(test_server(), kValidFeed2, browser(), id, true, |
448 "Feed for MyFeed2", | 464 "Feed for MyFeed2", |
449 "My item title1", | 465 "My item title1", |
450 "This is a summary.", | 466 "This is a summary.", |
451 "No error"); | 467 "No error"); |
452 } | 468 } |
453 | 469 |
454 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeed3) { | 470 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeed3) { |
455 ASSERT_TRUE(test_server()->Start()); | 471 ASSERT_TRUE(test_server()->Start()); |
456 | 472 |
| 473 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 474 switches::kAllowLegacyExtensionManifests); |
| 475 |
457 const Extension* extension = LoadExtension( | 476 const Extension* extension = LoadExtension( |
458 test_data_dir_.AppendASCII("subscribe_page_action")); | 477 test_data_dir_.AppendASCII("subscribe_page_action")); |
459 ASSERT_TRUE(extension); | 478 ASSERT_TRUE(extension); |
460 std::string id = extension->id(); | 479 std::string id = extension->id(); |
461 | 480 |
462 NavigateToFeedAndValidate(test_server(), kValidFeed3, browser(), id, true, | 481 NavigateToFeedAndValidate(test_server(), kValidFeed3, browser(), id, true, |
463 "Feed for Google Code buglist rss feed", | 482 "Feed for Google Code buglist rss feed", |
464 "My dear title", | 483 "My dear title", |
465 "My dear content", | 484 "My dear content", |
466 "No error"); | 485 "No error"); |
467 } | 486 } |
468 | 487 |
469 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeed4) { | 488 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeed4) { |
470 ASSERT_TRUE(test_server()->Start()); | 489 ASSERT_TRUE(test_server()->Start()); |
471 | 490 |
| 491 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 492 switches::kAllowLegacyExtensionManifests); |
| 493 |
472 const Extension* extension = LoadExtension( | 494 const Extension* extension = LoadExtension( |
473 test_data_dir_.AppendASCII("subscribe_page_action")); | 495 test_data_dir_.AppendASCII("subscribe_page_action")); |
474 ASSERT_TRUE(extension); | 496 ASSERT_TRUE(extension); |
475 std::string id = extension->id(); | 497 std::string id = extension->id(); |
476 | 498 |
477 NavigateToFeedAndValidate(test_server(), kValidFeed4, browser(), id, true, | 499 NavigateToFeedAndValidate(test_server(), kValidFeed4, browser(), id, true, |
478 "Feed for Title chars <script> %23 stop", | 500 "Feed for Title chars <script> %23 stop", |
479 "Title chars %23 stop", | 501 "Title chars %23 stop", |
480 "My dear content %23 stop", | 502 "My dear content %23 stop", |
481 "No error"); | 503 "No error"); |
482 } | 504 } |
483 | 505 |
484 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeed0) { | 506 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeed0) { |
485 ASSERT_TRUE(test_server()->Start()); | 507 ASSERT_TRUE(test_server()->Start()); |
486 | 508 |
| 509 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 510 switches::kAllowLegacyExtensionManifests); |
| 511 |
487 const Extension* extension = LoadExtension( | 512 const Extension* extension = LoadExtension( |
488 test_data_dir_.AppendASCII("subscribe_page_action")); | 513 test_data_dir_.AppendASCII("subscribe_page_action")); |
489 ASSERT_TRUE(extension); | 514 ASSERT_TRUE(extension); |
490 std::string id = extension->id(); | 515 std::string id = extension->id(); |
491 | 516 |
492 // Try a feed with a link with an onclick handler (before r27440 this would | 517 // Try a feed with a link with an onclick handler (before r27440 this would |
493 // trigger a NOTREACHED). | 518 // trigger a NOTREACHED). |
494 NavigateToFeedAndValidate(test_server(), kValidFeed0, browser(), id, true, | 519 NavigateToFeedAndValidate(test_server(), kValidFeed0, browser(), id, true, |
495 "Feed for MyFeedTitle", | 520 "Feed for MyFeedTitle", |
496 "Title 1", | 521 "Title 1", |
497 "Desc VIDEO", | 522 "Desc VIDEO", |
498 "No error"); | 523 "No error"); |
499 } | 524 } |
500 | 525 |
501 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeed5) { | 526 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeed5) { |
502 ASSERT_TRUE(test_server()->Start()); | 527 ASSERT_TRUE(test_server()->Start()); |
503 | 528 |
| 529 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 530 switches::kAllowLegacyExtensionManifests); |
| 531 |
504 const Extension* extension = LoadExtension( | 532 const Extension* extension = LoadExtension( |
505 test_data_dir_.AppendASCII("subscribe_page_action")); | 533 test_data_dir_.AppendASCII("subscribe_page_action")); |
506 ASSERT_TRUE(extension); | 534 ASSERT_TRUE(extension); |
507 std::string id = extension->id(); | 535 std::string id = extension->id(); |
508 | 536 |
509 // Feed with valid but mostly empty xml. | 537 // Feed with valid but mostly empty xml. |
510 NavigateToFeedAndValidate(test_server(), kValidFeed5, browser(), id, true, | 538 NavigateToFeedAndValidate(test_server(), kValidFeed5, browser(), id, true, |
511 "Feed for Unknown feed name", | 539 "Feed for Unknown feed name", |
512 "element 'anchor_0' not found", | 540 "element 'anchor_0' not found", |
513 "element 'desc_0' not found", | 541 "element 'desc_0' not found", |
514 "This feed contains no entries."); | 542 "This feed contains no entries."); |
515 } | 543 } |
516 | 544 |
517 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeed6) { | 545 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeed6) { |
518 ASSERT_TRUE(test_server()->Start()); | 546 ASSERT_TRUE(test_server()->Start()); |
519 | 547 |
| 548 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 549 switches::kAllowLegacyExtensionManifests); |
| 550 |
520 const Extension* extension = LoadExtension( | 551 const Extension* extension = LoadExtension( |
521 test_data_dir_.AppendASCII("subscribe_page_action")); | 552 test_data_dir_.AppendASCII("subscribe_page_action")); |
522 ASSERT_TRUE(extension); | 553 ASSERT_TRUE(extension); |
523 std::string id = extension->id(); | 554 std::string id = extension->id(); |
524 | 555 |
525 // Feed that is technically invalid but still parseable. | 556 // Feed that is technically invalid but still parseable. |
526 NavigateToFeedAndValidate(test_server(), kValidFeed6, browser(), id, true, | 557 NavigateToFeedAndValidate(test_server(), kValidFeed6, browser(), id, true, |
527 "Feed for MyFeedTitle", | 558 "Feed for MyFeedTitle", |
528 "Title 1", | 559 "Title 1", |
529 "Desc", | 560 "Desc", |
530 "No error"); | 561 "No error"); |
531 } | 562 } |
532 | 563 |
533 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedInvalidFeed1) { | 564 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedInvalidFeed1) { |
534 ASSERT_TRUE(test_server()->Start()); | 565 ASSERT_TRUE(test_server()->Start()); |
535 | 566 |
| 567 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 568 switches::kAllowLegacyExtensionManifests); |
| 569 |
536 const Extension* extension = LoadExtension( | 570 const Extension* extension = LoadExtension( |
537 test_data_dir_.AppendASCII("subscribe_page_action")); | 571 test_data_dir_.AppendASCII("subscribe_page_action")); |
538 ASSERT_TRUE(extension); | 572 ASSERT_TRUE(extension); |
539 std::string id = extension->id(); | 573 std::string id = extension->id(); |
540 | 574 |
541 // Try an empty feed. | 575 // Try an empty feed. |
542 NavigateToFeedAndValidate(test_server(), kInvalidFeed1, browser(), id, false, | 576 NavigateToFeedAndValidate(test_server(), kInvalidFeed1, browser(), id, false, |
543 "Feed for Unknown feed name", | 577 "Feed for Unknown feed name", |
544 "element 'anchor_0' not found", | 578 "element 'anchor_0' not found", |
545 "element 'desc_0' not found", | 579 "element 'desc_0' not found", |
546 "This feed contains no entries."); | 580 "This feed contains no entries."); |
547 } | 581 } |
548 | 582 |
549 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedInvalidFeed2) { | 583 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedInvalidFeed2) { |
550 ASSERT_TRUE(test_server()->Start()); | 584 ASSERT_TRUE(test_server()->Start()); |
551 | 585 |
| 586 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 587 switches::kAllowLegacyExtensionManifests); |
| 588 |
552 const Extension* extension = LoadExtension( | 589 const Extension* extension = LoadExtension( |
553 test_data_dir_.AppendASCII("subscribe_page_action")); | 590 test_data_dir_.AppendASCII("subscribe_page_action")); |
554 ASSERT_TRUE(extension); | 591 ASSERT_TRUE(extension); |
555 std::string id = extension->id(); | 592 std::string id = extension->id(); |
556 | 593 |
557 // Try a garbage feed. | 594 // Try a garbage feed. |
558 NavigateToFeedAndValidate(test_server(), kInvalidFeed2, browser(), id, false, | 595 NavigateToFeedAndValidate(test_server(), kInvalidFeed2, browser(), id, false, |
559 "Feed for Unknown feed name", | 596 "Feed for Unknown feed name", |
560 "element 'anchor_0' not found", | 597 "element 'anchor_0' not found", |
561 "element 'desc_0' not found", | 598 "element 'desc_0' not found", |
562 "This feed contains no entries."); | 599 "This feed contains no entries."); |
563 } | 600 } |
564 | 601 |
565 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedInvalidFeed3) { | 602 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedInvalidFeed3) { |
566 ASSERT_TRUE(test_server()->Start()); | 603 ASSERT_TRUE(test_server()->Start()); |
567 | 604 |
| 605 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 606 switches::kAllowLegacyExtensionManifests); |
| 607 |
568 const Extension* extension = LoadExtension( | 608 const Extension* extension = LoadExtension( |
569 test_data_dir_.AppendASCII("subscribe_page_action")); | 609 test_data_dir_.AppendASCII("subscribe_page_action")); |
570 ASSERT_TRUE(extension); | 610 ASSERT_TRUE(extension); |
571 std::string id = extension->id(); | 611 std::string id = extension->id(); |
572 | 612 |
573 // Try a feed that doesn't exist. | 613 // Try a feed that doesn't exist. |
574 NavigateToFeedAndValidate(test_server(), "foo.xml", browser(), id, false, | 614 NavigateToFeedAndValidate(test_server(), "foo.xml", browser(), id, false, |
575 "Feed for Unknown feed name", | 615 "Feed for Unknown feed name", |
576 "element 'anchor_0' not found", | 616 "element 'anchor_0' not found", |
577 "element 'desc_0' not found", | 617 "element 'desc_0' not found", |
578 "This feed contains no entries."); | 618 "This feed contains no entries."); |
579 } | 619 } |
580 | 620 |
581 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedInvalidFeed4) { | 621 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedInvalidFeed4) { |
582 ASSERT_TRUE(test_server()->Start()); | 622 ASSERT_TRUE(test_server()->Start()); |
583 | 623 |
| 624 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 625 switches::kAllowLegacyExtensionManifests); |
| 626 |
584 const Extension* extension = LoadExtension( | 627 const Extension* extension = LoadExtension( |
585 test_data_dir_.AppendASCII("subscribe_page_action")); | 628 test_data_dir_.AppendASCII("subscribe_page_action")); |
586 ASSERT_TRUE(extension); | 629 ASSERT_TRUE(extension); |
587 std::string id = extension->id(); | 630 std::string id = extension->id(); |
588 | 631 |
589 // subscribe.js shouldn't double-decode the URL passed in. Otherwise feed | 632 // subscribe.js shouldn't double-decode the URL passed in. Otherwise feed |
590 // links such as http://search.twitter.com/search.atom?lang=en&q=%23chrome | 633 // links such as http://search.twitter.com/search.atom?lang=en&q=%23chrome |
591 // will result in no feed being downloaded because %23 gets decoded to # and | 634 // will result in no feed being downloaded because %23 gets decoded to # and |
592 // therefore #chrome is not treated as part of the Twitter query. This test | 635 // therefore #chrome is not treated as part of the Twitter query. This test |
593 // uses an underscore instead of a hash, but the principle is the same. If | 636 // uses an underscore instead of a hash, but the principle is the same. If |
594 // we start erroneously double decoding again, the path (and the feed) will | 637 // we start erroneously double decoding again, the path (and the feed) will |
595 // become valid resulting in a failure for this test. | 638 // become valid resulting in a failure for this test. |
596 NavigateToFeedAndValidate( | 639 NavigateToFeedAndValidate( |
597 test_server(), kFeedTripleEncoded, browser(), id, true, | 640 test_server(), kFeedTripleEncoded, browser(), id, true, |
598 "Feed for Unknown feed name", | 641 "Feed for Unknown feed name", |
599 "element 'anchor_0' not found", | 642 "element 'anchor_0' not found", |
600 "element 'desc_0' not found", | 643 "element 'desc_0' not found", |
601 "This feed contains no entries."); | 644 "This feed contains no entries."); |
602 } | 645 } |
603 | 646 |
604 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeedNoLinks) { | 647 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeedNoLinks) { |
605 ASSERT_TRUE(test_server()->Start()); | 648 ASSERT_TRUE(test_server()->Start()); |
606 | 649 |
| 650 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 651 switches::kAllowLegacyExtensionManifests); |
| 652 |
607 const Extension* extension = LoadExtension( | 653 const Extension* extension = LoadExtension( |
608 test_data_dir_.AppendASCII("subscribe_page_action")); | 654 test_data_dir_.AppendASCII("subscribe_page_action")); |
609 ASSERT_TRUE(extension); | 655 ASSERT_TRUE(extension); |
610 std::string id = extension->id(); | 656 std::string id = extension->id(); |
611 | 657 |
612 // Valid feed but containing no links. | 658 // Valid feed but containing no links. |
613 NavigateToFeedAndValidate( | 659 NavigateToFeedAndValidate( |
614 test_server(), kValidFeedNoLinks, browser(), id, true, | 660 test_server(), kValidFeedNoLinks, browser(), id, true, |
615 "Feed for MyFeedTitle", | 661 "Feed for MyFeedTitle", |
616 "Title with no link", | 662 "Title with no link", |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 | 920 |
875 EXPECT_EQ(extension->GetResourceURL("options.html"), | 921 EXPECT_EQ(extension->GetResourceURL("options.html"), |
876 tab_strip->GetTabContentsAt(1)->tab_contents()->GetURL()); | 922 tab_strip->GetTabContentsAt(1)->tab_contents()->GetURL()); |
877 } | 923 } |
878 | 924 |
879 //============================================================================== | 925 //============================================================================== |
880 // STOP! Please do not add any more random-ass tests here. Create new files for | 926 // STOP! Please do not add any more random-ass tests here. Create new files for |
881 // your tests grouped by functionality. Also, you should strongly consider using | 927 // your tests grouped by functionality. Also, you should strongly consider using |
882 // ExtensionAPITest if possible. | 928 // ExtensionAPITest if possible. |
883 //============================================================================== | 929 //============================================================================== |
OLD | NEW |