| 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 "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" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 GURL feed_url = test_server()->GetURL(kFeedPage); | 147 GURL feed_url = test_server()->GetURL(kFeedPage); |
| 148 ui_test_utils::NavigateToURL(browser(), feed_url); | 148 ui_test_utils::NavigateToURL(browser(), feed_url); |
| 149 // We should now have one page action ready to go in the LocationBar. | 149 // We should now have one page action ready to go in the LocationBar. |
| 150 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(1)); | 150 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(1)); |
| 151 } | 151 } |
| 152 | 152 |
| 153 // Tests that we can load page actions in the Omnibox. | 153 // Tests that we can load page actions in the Omnibox. |
| 154 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, PageAction) { | 154 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, PageAction) { |
| 155 ASSERT_TRUE(test_server()->Start()); | 155 ASSERT_TRUE(test_server()->Start()); |
| 156 | 156 |
| 157 CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 158 switches::kAllowLegacyExtensionManifests); | |
| 159 | |
| 160 ASSERT_TRUE(LoadExtension( | 157 ASSERT_TRUE(LoadExtension( |
| 161 test_data_dir_.AppendASCII("subscribe_page_action"))); | 158 test_data_dir_.AppendASCII("subscribe_page_action"))); |
| 162 | 159 |
| 163 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(0)); | 160 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(0)); |
| 164 | 161 |
| 165 // Navigate to the feed page. | 162 // Navigate to the feed page. |
| 166 GURL feed_url = test_server()->GetURL(kFeedPage); | 163 GURL feed_url = test_server()->GetURL(kFeedPage); |
| 167 ui_test_utils::NavigateToURL(browser(), feed_url); | 164 ui_test_utils::NavigateToURL(browser(), feed_url); |
| 168 // We should now have one page action ready to go in the LocationBar. | 165 // We should now have one page action ready to go in the LocationBar. |
| 169 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(1)); | 166 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(1)); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 197 // Not an in-page navigation, page action should go away. | 194 // Not an in-page navigation, page action should go away. |
| 198 feed_url = test_server()->GetURL(kHashPageB); | 195 feed_url = test_server()->GetURL(kHashPageB); |
| 199 ui_test_utils::NavigateToURL(browser(), feed_url); | 196 ui_test_utils::NavigateToURL(browser(), feed_url); |
| 200 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(0)); | 197 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(0)); |
| 201 } | 198 } |
| 202 | 199 |
| 203 // Tests that the location bar forgets about unloaded page actions. | 200 // Tests that the location bar forgets about unloaded page actions. |
| 204 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, UnloadPageAction) { | 201 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, UnloadPageAction) { |
| 205 ASSERT_TRUE(test_server()->Start()); | 202 ASSERT_TRUE(test_server()->Start()); |
| 206 | 203 |
| 207 CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 208 switches::kAllowLegacyExtensionManifests); | |
| 209 | |
| 210 FilePath extension_path(test_data_dir_.AppendASCII("subscribe_page_action")); | 204 FilePath extension_path(test_data_dir_.AppendASCII("subscribe_page_action")); |
| 211 ASSERT_TRUE(LoadExtension(extension_path)); | 205 ASSERT_TRUE(LoadExtension(extension_path)); |
| 212 | 206 |
| 213 // Navigation prompts the location bar to load page actions. | 207 // Navigation prompts the location bar to load page actions. |
| 214 GURL feed_url = test_server()->GetURL(kFeedPage); | 208 GURL feed_url = test_server()->GetURL(kFeedPage); |
| 215 ui_test_utils::NavigateToURL(browser(), feed_url); | 209 ui_test_utils::NavigateToURL(browser(), feed_url); |
| 216 ASSERT_TRUE(WaitForPageActionCountChangeTo(1)); | 210 ASSERT_TRUE(WaitForPageActionCountChangeTo(1)); |
| 217 | 211 |
| 218 UnloadExtension(last_loaded_extension_id_); | 212 UnloadExtension(last_loaded_extension_id_); |
| 219 | 213 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 LOG(INFO) << "Test completed : " | 267 LOG(INFO) << "Test completed : " |
| 274 << (base::TimeTicks::Now() - start_time).InMilliseconds() | 268 << (base::TimeTicks::Now() - start_time).InMilliseconds() |
| 275 << " ms" << std::flush; | 269 << " ms" << std::flush; |
| 276 } | 270 } |
| 277 | 271 |
| 278 // Makes sure that the RSS detects RSS feed links, even when rel tag contains | 272 // Makes sure that the RSS detects RSS feed links, even when rel tag contains |
| 279 // more than just "alternate". | 273 // more than just "alternate". |
| 280 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, RSSMultiRelLink) { | 274 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, RSSMultiRelLink) { |
| 281 ASSERT_TRUE(test_server()->Start()); | 275 ASSERT_TRUE(test_server()->Start()); |
| 282 | 276 |
| 283 CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 284 switches::kAllowLegacyExtensionManifests); | |
| 285 | |
| 286 ASSERT_TRUE(LoadExtension( | 277 ASSERT_TRUE(LoadExtension( |
| 287 test_data_dir_.AppendASCII("subscribe_page_action"))); | 278 test_data_dir_.AppendASCII("subscribe_page_action"))); |
| 288 | 279 |
| 289 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(0)); | 280 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(0)); |
| 290 | 281 |
| 291 // Navigate to the feed page. | 282 // Navigate to the feed page. |
| 292 GURL feed_url = test_server()->GetURL(kFeedPageMultiRel); | 283 GURL feed_url = test_server()->GetURL(kFeedPageMultiRel); |
| 293 ui_test_utils::NavigateToURL(browser(), feed_url); | 284 ui_test_utils::NavigateToURL(browser(), feed_url); |
| 294 // We should now have one page action ready to go in the LocationBar. | 285 // We should now have one page action ready to go in the LocationBar. |
| 295 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(1)); | 286 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(1)); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 expected_item_desc)); | 431 expected_item_desc)); |
| 441 ASSERT_TRUE(ValidatePageElement(tab, | 432 ASSERT_TRUE(ValidatePageElement(tab, |
| 442 L"//html/body/div/iframe[1]", | 433 L"//html/body/div/iframe[1]", |
| 443 jscript_error, | 434 jscript_error, |
| 444 expected_error)); | 435 expected_error)); |
| 445 } | 436 } |
| 446 | 437 |
| 447 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeed1) { | 438 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeed1) { |
| 448 ASSERT_TRUE(test_server()->Start()); | 439 ASSERT_TRUE(test_server()->Start()); |
| 449 | 440 |
| 450 CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 451 switches::kAllowLegacyExtensionManifests); | |
| 452 | |
| 453 const Extension* extension = LoadExtension( | 441 const Extension* extension = LoadExtension( |
| 454 test_data_dir_.AppendASCII("subscribe_page_action")); | 442 test_data_dir_.AppendASCII("subscribe_page_action")); |
| 455 ASSERT_TRUE(extension); | 443 ASSERT_TRUE(extension); |
| 456 std::string id = extension->id(); | 444 std::string id = extension->id(); |
| 457 | 445 |
| 458 NavigateToFeedAndValidate(test_server(), kValidFeed1, browser(), id, true, | 446 NavigateToFeedAndValidate(test_server(), kValidFeed1, browser(), id, true, |
| 459 "Feed for MyFeedTitle", | 447 "Feed for MyFeedTitle", |
| 460 "Title 1", | 448 "Title 1", |
| 461 "Desc", | 449 "Desc", |
| 462 "No error"); | 450 "No error"); |
| 463 } | 451 } |
| 464 | 452 |
| 465 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeed2) { | 453 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeed2) { |
| 466 ASSERT_TRUE(test_server()->Start()); | 454 ASSERT_TRUE(test_server()->Start()); |
| 467 | 455 |
| 468 CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 469 switches::kAllowLegacyExtensionManifests); | |
| 470 | |
| 471 const Extension* extension = LoadExtension( | 456 const Extension* extension = LoadExtension( |
| 472 test_data_dir_.AppendASCII("subscribe_page_action")); | 457 test_data_dir_.AppendASCII("subscribe_page_action")); |
| 473 ASSERT_TRUE(extension); | 458 ASSERT_TRUE(extension); |
| 474 std::string id = extension->id(); | 459 std::string id = extension->id(); |
| 475 | 460 |
| 476 NavigateToFeedAndValidate(test_server(), kValidFeed2, browser(), id, true, | 461 NavigateToFeedAndValidate(test_server(), kValidFeed2, browser(), id, true, |
| 477 "Feed for MyFeed2", | 462 "Feed for MyFeed2", |
| 478 "My item title1", | 463 "My item title1", |
| 479 "This is a summary.", | 464 "This is a summary.", |
| 480 "No error"); | 465 "No error"); |
| 481 } | 466 } |
| 482 | 467 |
| 483 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeed3) { | 468 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeed3) { |
| 484 ASSERT_TRUE(test_server()->Start()); | 469 ASSERT_TRUE(test_server()->Start()); |
| 485 | 470 |
| 486 CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 487 switches::kAllowLegacyExtensionManifests); | |
| 488 | |
| 489 const Extension* extension = LoadExtension( | 471 const Extension* extension = LoadExtension( |
| 490 test_data_dir_.AppendASCII("subscribe_page_action")); | 472 test_data_dir_.AppendASCII("subscribe_page_action")); |
| 491 ASSERT_TRUE(extension); | 473 ASSERT_TRUE(extension); |
| 492 std::string id = extension->id(); | 474 std::string id = extension->id(); |
| 493 | 475 |
| 494 NavigateToFeedAndValidate(test_server(), kValidFeed3, browser(), id, true, | 476 NavigateToFeedAndValidate(test_server(), kValidFeed3, browser(), id, true, |
| 495 "Feed for Google Code buglist rss feed", | 477 "Feed for Google Code buglist rss feed", |
| 496 "My dear title", | 478 "My dear title", |
| 497 "My dear content", | 479 "My dear content", |
| 498 "No error"); | 480 "No error"); |
| 499 } | 481 } |
| 500 | 482 |
| 501 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeed4) { | 483 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeed4) { |
| 502 ASSERT_TRUE(test_server()->Start()); | 484 ASSERT_TRUE(test_server()->Start()); |
| 503 | 485 |
| 504 CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 505 switches::kAllowLegacyExtensionManifests); | |
| 506 | |
| 507 const Extension* extension = LoadExtension( | 486 const Extension* extension = LoadExtension( |
| 508 test_data_dir_.AppendASCII("subscribe_page_action")); | 487 test_data_dir_.AppendASCII("subscribe_page_action")); |
| 509 ASSERT_TRUE(extension); | 488 ASSERT_TRUE(extension); |
| 510 std::string id = extension->id(); | 489 std::string id = extension->id(); |
| 511 | 490 |
| 512 NavigateToFeedAndValidate(test_server(), kValidFeed4, browser(), id, true, | 491 NavigateToFeedAndValidate(test_server(), kValidFeed4, browser(), id, true, |
| 513 "Feed for Title chars <script> %23 stop", | 492 "Feed for Title chars <script> %23 stop", |
| 514 "Title chars %23 stop", | 493 "Title chars %23 stop", |
| 515 "My dear content %23 stop", | 494 "My dear content %23 stop", |
| 516 "No error"); | 495 "No error"); |
| 517 } | 496 } |
| 518 | 497 |
| 519 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeed0) { | 498 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeed0) { |
| 520 ASSERT_TRUE(test_server()->Start()); | 499 ASSERT_TRUE(test_server()->Start()); |
| 521 | 500 |
| 522 CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 523 switches::kAllowLegacyExtensionManifests); | |
| 524 | |
| 525 const Extension* extension = LoadExtension( | 501 const Extension* extension = LoadExtension( |
| 526 test_data_dir_.AppendASCII("subscribe_page_action")); | 502 test_data_dir_.AppendASCII("subscribe_page_action")); |
| 527 ASSERT_TRUE(extension); | 503 ASSERT_TRUE(extension); |
| 528 std::string id = extension->id(); | 504 std::string id = extension->id(); |
| 529 | 505 |
| 530 // Try a feed with a link with an onclick handler (before r27440 this would | 506 // Try a feed with a link with an onclick handler (before r27440 this would |
| 531 // trigger a NOTREACHED). | 507 // trigger a NOTREACHED). |
| 532 NavigateToFeedAndValidate(test_server(), kValidFeed0, browser(), id, true, | 508 NavigateToFeedAndValidate(test_server(), kValidFeed0, browser(), id, true, |
| 533 "Feed for MyFeedTitle", | 509 "Feed for MyFeedTitle", |
| 534 "Title 1", | 510 "Title 1", |
| 535 "Desc VIDEO", | 511 "Desc VIDEO", |
| 536 "No error"); | 512 "No error"); |
| 537 } | 513 } |
| 538 | 514 |
| 539 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeed5) { | 515 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeed5) { |
| 540 ASSERT_TRUE(test_server()->Start()); | 516 ASSERT_TRUE(test_server()->Start()); |
| 541 | 517 |
| 542 CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 543 switches::kAllowLegacyExtensionManifests); | |
| 544 | |
| 545 const Extension* extension = LoadExtension( | 518 const Extension* extension = LoadExtension( |
| 546 test_data_dir_.AppendASCII("subscribe_page_action")); | 519 test_data_dir_.AppendASCII("subscribe_page_action")); |
| 547 ASSERT_TRUE(extension); | 520 ASSERT_TRUE(extension); |
| 548 std::string id = extension->id(); | 521 std::string id = extension->id(); |
| 549 | 522 |
| 550 // Feed with valid but mostly empty xml. | 523 // Feed with valid but mostly empty xml. |
| 551 NavigateToFeedAndValidate(test_server(), kValidFeed5, browser(), id, true, | 524 NavigateToFeedAndValidate(test_server(), kValidFeed5, browser(), id, true, |
| 552 "Feed for Unknown feed name", | 525 "Feed for Unknown feed name", |
| 553 "element 'anchor_0' not found", | 526 "element 'anchor_0' not found", |
| 554 "element 'desc_0' not found", | 527 "element 'desc_0' not found", |
| 555 "This feed contains no entries."); | 528 "This feed contains no entries."); |
| 556 } | 529 } |
| 557 | 530 |
| 558 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeed6) { | 531 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeed6) { |
| 559 ASSERT_TRUE(test_server()->Start()); | 532 ASSERT_TRUE(test_server()->Start()); |
| 560 | 533 |
| 561 CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 562 switches::kAllowLegacyExtensionManifests); | |
| 563 | |
| 564 const Extension* extension = LoadExtension( | 534 const Extension* extension = LoadExtension( |
| 565 test_data_dir_.AppendASCII("subscribe_page_action")); | 535 test_data_dir_.AppendASCII("subscribe_page_action")); |
| 566 ASSERT_TRUE(extension); | 536 ASSERT_TRUE(extension); |
| 567 std::string id = extension->id(); | 537 std::string id = extension->id(); |
| 568 | 538 |
| 569 // Feed that is technically invalid but still parseable. | 539 // Feed that is technically invalid but still parseable. |
| 570 NavigateToFeedAndValidate(test_server(), kValidFeed6, browser(), id, true, | 540 NavigateToFeedAndValidate(test_server(), kValidFeed6, browser(), id, true, |
| 571 "Feed for MyFeedTitle", | 541 "Feed for MyFeedTitle", |
| 572 "Title 1", | 542 "Title 1", |
| 573 "Desc", | 543 "Desc", |
| 574 "No error"); | 544 "No error"); |
| 575 } | 545 } |
| 576 | 546 |
| 577 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedInvalidFeed1) { | 547 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedInvalidFeed1) { |
| 578 ASSERT_TRUE(test_server()->Start()); | 548 ASSERT_TRUE(test_server()->Start()); |
| 579 | 549 |
| 580 CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 581 switches::kAllowLegacyExtensionManifests); | |
| 582 | |
| 583 const Extension* extension = LoadExtension( | 550 const Extension* extension = LoadExtension( |
| 584 test_data_dir_.AppendASCII("subscribe_page_action")); | 551 test_data_dir_.AppendASCII("subscribe_page_action")); |
| 585 ASSERT_TRUE(extension); | 552 ASSERT_TRUE(extension); |
| 586 std::string id = extension->id(); | 553 std::string id = extension->id(); |
| 587 | 554 |
| 588 // Try an empty feed. | 555 // Try an empty feed. |
| 589 NavigateToFeedAndValidate(test_server(), kInvalidFeed1, browser(), id, false, | 556 NavigateToFeedAndValidate(test_server(), kInvalidFeed1, browser(), id, false, |
| 590 "Feed for Unknown feed name", | 557 "Feed for Unknown feed name", |
| 591 "element 'anchor_0' not found", | 558 "element 'anchor_0' not found", |
| 592 "element 'desc_0' not found", | 559 "element 'desc_0' not found", |
| 593 "This feed contains no entries."); | 560 "This feed contains no entries."); |
| 594 } | 561 } |
| 595 | 562 |
| 596 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedInvalidFeed2) { | 563 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedInvalidFeed2) { |
| 597 ASSERT_TRUE(test_server()->Start()); | 564 ASSERT_TRUE(test_server()->Start()); |
| 598 | 565 |
| 599 CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 600 switches::kAllowLegacyExtensionManifests); | |
| 601 | |
| 602 const Extension* extension = LoadExtension( | 566 const Extension* extension = LoadExtension( |
| 603 test_data_dir_.AppendASCII("subscribe_page_action")); | 567 test_data_dir_.AppendASCII("subscribe_page_action")); |
| 604 ASSERT_TRUE(extension); | 568 ASSERT_TRUE(extension); |
| 605 std::string id = extension->id(); | 569 std::string id = extension->id(); |
| 606 | 570 |
| 607 // Try a garbage feed. | 571 // Try a garbage feed. |
| 608 NavigateToFeedAndValidate(test_server(), kInvalidFeed2, browser(), id, false, | 572 NavigateToFeedAndValidate(test_server(), kInvalidFeed2, browser(), id, false, |
| 609 "Feed for Unknown feed name", | 573 "Feed for Unknown feed name", |
| 610 "element 'anchor_0' not found", | 574 "element 'anchor_0' not found", |
| 611 "element 'desc_0' not found", | 575 "element 'desc_0' not found", |
| 612 "This feed contains no entries."); | 576 "This feed contains no entries."); |
| 613 } | 577 } |
| 614 | 578 |
| 615 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedInvalidFeed3) { | 579 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedInvalidFeed3) { |
| 616 ASSERT_TRUE(test_server()->Start()); | 580 ASSERT_TRUE(test_server()->Start()); |
| 617 | 581 |
| 618 CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 619 switches::kAllowLegacyExtensionManifests); | |
| 620 | |
| 621 const Extension* extension = LoadExtension( | 582 const Extension* extension = LoadExtension( |
| 622 test_data_dir_.AppendASCII("subscribe_page_action")); | 583 test_data_dir_.AppendASCII("subscribe_page_action")); |
| 623 ASSERT_TRUE(extension); | 584 ASSERT_TRUE(extension); |
| 624 std::string id = extension->id(); | 585 std::string id = extension->id(); |
| 625 | 586 |
| 626 // Try a feed that doesn't exist. | 587 // Try a feed that doesn't exist. |
| 627 NavigateToFeedAndValidate(test_server(), "foo.xml", browser(), id, false, | 588 NavigateToFeedAndValidate(test_server(), "foo.xml", browser(), id, false, |
| 628 "Feed for Unknown feed name", | 589 "Feed for Unknown feed name", |
| 629 "element 'anchor_0' not found", | 590 "element 'anchor_0' not found", |
| 630 "element 'desc_0' not found", | 591 "element 'desc_0' not found", |
| 631 "This feed contains no entries."); | 592 "This feed contains no entries."); |
| 632 } | 593 } |
| 633 | 594 |
| 634 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedInvalidFeed4) { | 595 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedInvalidFeed4) { |
| 635 ASSERT_TRUE(test_server()->Start()); | 596 ASSERT_TRUE(test_server()->Start()); |
| 636 | 597 |
| 637 CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 638 switches::kAllowLegacyExtensionManifests); | |
| 639 | |
| 640 const Extension* extension = LoadExtension( | 598 const Extension* extension = LoadExtension( |
| 641 test_data_dir_.AppendASCII("subscribe_page_action")); | 599 test_data_dir_.AppendASCII("subscribe_page_action")); |
| 642 ASSERT_TRUE(extension); | 600 ASSERT_TRUE(extension); |
| 643 std::string id = extension->id(); | 601 std::string id = extension->id(); |
| 644 | 602 |
| 645 // subscribe.js shouldn't double-decode the URL passed in. Otherwise feed | 603 // subscribe.js shouldn't double-decode the URL passed in. Otherwise feed |
| 646 // links such as http://search.twitter.com/search.atom?lang=en&q=%23chrome | 604 // links such as http://search.twitter.com/search.atom?lang=en&q=%23chrome |
| 647 // will result in no feed being downloaded because %23 gets decoded to # and | 605 // will result in no feed being downloaded because %23 gets decoded to # and |
| 648 // therefore #chrome is not treated as part of the Twitter query. This test | 606 // therefore #chrome is not treated as part of the Twitter query. This test |
| 649 // uses an underscore instead of a hash, but the principle is the same. If | 607 // uses an underscore instead of a hash, but the principle is the same. If |
| 650 // we start erroneously double decoding again, the path (and the feed) will | 608 // we start erroneously double decoding again, the path (and the feed) will |
| 651 // become valid resulting in a failure for this test. | 609 // become valid resulting in a failure for this test. |
| 652 NavigateToFeedAndValidate( | 610 NavigateToFeedAndValidate( |
| 653 test_server(), kFeedTripleEncoded, browser(), id, true, | 611 test_server(), kFeedTripleEncoded, browser(), id, true, |
| 654 "Feed for Unknown feed name", | 612 "Feed for Unknown feed name", |
| 655 "element 'anchor_0' not found", | 613 "element 'anchor_0' not found", |
| 656 "element 'desc_0' not found", | 614 "element 'desc_0' not found", |
| 657 "This feed contains no entries."); | 615 "This feed contains no entries."); |
| 658 } | 616 } |
| 659 | 617 |
| 660 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeedNoLinks) { | 618 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeedNoLinks) { |
| 661 ASSERT_TRUE(test_server()->Start()); | 619 ASSERT_TRUE(test_server()->Start()); |
| 662 | 620 |
| 663 CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 664 switches::kAllowLegacyExtensionManifests); | |
| 665 | |
| 666 const Extension* extension = LoadExtension( | 621 const Extension* extension = LoadExtension( |
| 667 test_data_dir_.AppendASCII("subscribe_page_action")); | 622 test_data_dir_.AppendASCII("subscribe_page_action")); |
| 668 ASSERT_TRUE(extension); | 623 ASSERT_TRUE(extension); |
| 669 std::string id = extension->id(); | 624 std::string id = extension->id(); |
| 670 | 625 |
| 671 // Valid feed but containing no links. | 626 // Valid feed but containing no links. |
| 672 NavigateToFeedAndValidate( | 627 NavigateToFeedAndValidate( |
| 673 test_server(), kValidFeedNoLinks, browser(), id, true, | 628 test_server(), kValidFeedNoLinks, browser(), id, true, |
| 674 "Feed for MyFeedTitle", | 629 "Feed for MyFeedTitle", |
| 675 "Title with no link", | 630 "Title with no link", |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 | 877 |
| 923 EXPECT_EQ(extension->GetResourceURL("options.html"), | 878 EXPECT_EQ(extension->GetResourceURL("options.html"), |
| 924 tab_strip->GetTabContentsAt(1)->web_contents()->GetURL()); | 879 tab_strip->GetTabContentsAt(1)->web_contents()->GetURL()); |
| 925 } | 880 } |
| 926 | 881 |
| 927 //============================================================================== | 882 //============================================================================== |
| 928 // STOP! Please do not add any more random-ass tests here. Create new files for | 883 // STOP! Please do not add any more random-ass tests here. Create new files for |
| 929 // your tests grouped by functionality. Also, you should strongly consider using | 884 // your tests grouped by functionality. Also, you should strongly consider using |
| 930 // ExtensionAPITest if possible. | 885 // ExtensionAPITest if possible. |
| 931 //============================================================================== | 886 //============================================================================== |
| OLD | NEW |