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

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

Issue 6332008: The RSS subscribe.js should not double-decoded the URL passed in.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/test/data/extensions/subscribe_page_action/subscribe.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/ref_counted.h" 6 #include "base/ref_counted.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/browser_list.h" 8 #include "chrome/browser/browser_list.h"
9 #include "chrome/browser/extensions/autoupdate_interceptor.h" 9 #include "chrome/browser/extensions/autoupdate_interceptor.h"
10 #include "chrome/browser/extensions/extension_apitest.h" 10 #include "chrome/browser/extensions/extension_apitest.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 const std::string kValidFeed2 = "files/feeds/feed2.xml"; 43 const std::string kValidFeed2 = "files/feeds/feed2.xml";
44 const std::string kValidFeed3 = "files/feeds/feed3.xml"; 44 const std::string kValidFeed3 = "files/feeds/feed3.xml";
45 const std::string kValidFeed4 = "files/feeds/feed4.xml"; 45 const std::string kValidFeed4 = "files/feeds/feed4.xml";
46 const std::string kValidFeed5 = "files/feeds/feed5.xml"; 46 const std::string kValidFeed5 = "files/feeds/feed5.xml";
47 const std::string kValidFeed6 = "files/feeds/feed6.xml"; 47 const std::string kValidFeed6 = "files/feeds/feed6.xml";
48 const std::string kValidFeedNoLinks = "files/feeds/feed_nolinks.xml"; 48 const std::string kValidFeedNoLinks = "files/feeds/feed_nolinks.xml";
49 const std::string kInvalidFeed1 = "files/feeds/feed_invalid1.xml"; 49 const std::string kInvalidFeed1 = "files/feeds/feed_invalid1.xml";
50 const std::string kInvalidFeed2 = "files/feeds/feed_invalid2.xml"; 50 const std::string kInvalidFeed2 = "files/feeds/feed_invalid2.xml";
51 const std::string kLocalization = 51 const std::string kLocalization =
52 "files/extensions/browsertest/title_localized_pa/simple.html"; 52 "files/extensions/browsertest/title_localized_pa/simple.html";
53 // We need a triple encoded string to prove that we are not decoding twice in
54 // subscribe.js because one layer is also stripped off when subscribe.js passes
55 // it to the XMLHttpRequest object.
56 const std::string kFeedTripleEncoded = "files/feeds/url%25255Fdecoding.html";
53 const std::string kHashPageA = 57 const std::string kHashPageA =
54 "files/extensions/api_test/page_action/hash_change/test_page_A.html"; 58 "files/extensions/api_test/page_action/hash_change/test_page_A.html";
55 const std::string kHashPageAHash = kHashPageA + "#asdf"; 59 const std::string kHashPageAHash = kHashPageA + "#asdf";
56 const std::string kHashPageB = 60 const std::string kHashPageB =
57 "files/extensions/api_test/page_action/hash_change/test_page_B.html"; 61 "files/extensions/api_test/page_action/hash_change/test_page_B.html";
58 62
59 // Looks for an ExtensionHost whose URL has the given path component (including 63 // Looks for an ExtensionHost whose URL has the given path component (including
60 // leading slash). Also verifies that the expected number of hosts are loaded. 64 // leading slash). Also verifies that the expected number of hosts are loaded.
61 static ExtensionHost* FindHostWithPath(ExtensionProcessManager* manager, 65 static ExtensionHost* FindHostWithPath(ExtensionProcessManager* manager,
62 const std::string& path, 66 const std::string& path,
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 test_data_dir_.AppendASCII("subscribe_page_action"))); 619 test_data_dir_.AppendASCII("subscribe_page_action")));
616 620
617 // Try a feed that doesn't exist. 621 // Try a feed that doesn't exist.
618 NavigateToFeedAndValidate(test_server(), "foo.xml", browser(), false, 622 NavigateToFeedAndValidate(test_server(), "foo.xml", browser(), false,
619 "Feed for Unknown feed name", 623 "Feed for Unknown feed name",
620 "element 'anchor_0' not found", 624 "element 'anchor_0' not found",
621 "element 'desc_0' not found", 625 "element 'desc_0' not found",
622 "This feed contains no entries."); 626 "This feed contains no entries.");
623 } 627 }
624 628
629 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedInvalidFeed4) {
630 ASSERT_TRUE(test_server()->Start());
631
632 ASSERT_TRUE(LoadExtension(
633 test_data_dir_.AppendASCII("subscribe_page_action")));
634
635 // subscribe.js shouldn't double-decode the URL passed in. Otherwise feed
636 // links such as http://search.twitter.com/search.atom?lang=en&q=%23chrome
637 // will result in no feed being downloaded because %23 gets decoded to # and
638 // therefore #chrome is not treated as part of the Twitter query. This test
639 // uses an underscore instead of a hash, but the principle is the same. If
640 // we start erroneously double decoding again, the path (and the feed) will
641 // become valid resulting in a failure for this test.
642 NavigateToFeedAndValidate(test_server(), kFeedTripleEncoded, browser(), true,
643 "Feed for Unknown feed name",
644 "element 'anchor_0' not found",
645 "element 'desc_0' not found",
646 "This feed contains no entries.");
647 }
648
625 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeedNoLinks) { 649 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeedNoLinks) {
626 ASSERT_TRUE(test_server()->Start()); 650 ASSERT_TRUE(test_server()->Start());
627 651
628 ASSERT_TRUE(LoadExtension( 652 ASSERT_TRUE(LoadExtension(
629 test_data_dir_.AppendASCII("subscribe_page_action"))); 653 test_data_dir_.AppendASCII("subscribe_page_action")));
630 654
631 // Valid feed but containing no links. 655 // Valid feed but containing no links.
632 NavigateToFeedAndValidate(test_server(), kValidFeedNoLinks, browser(), true, 656 NavigateToFeedAndValidate(test_server(), kValidFeedNoLinks, browser(), true,
633 "Feed for MyFeedTitle", 657 "Feed for MyFeedTitle",
634 "Title with no link", 658 "Title with no link",
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 L" window.chrome.app.isInstalled = false;" 920 L" window.chrome.app.isInstalled = false;"
897 L" return 'BAD: Should have thrown by now...';" 921 L" return 'BAD: Should have thrown by now...';"
898 L" } catch (e) {" 922 L" } catch (e) {"
899 L" return 'GOOD: Saw expected error.';" 923 L" return 'GOOD: Saw expected error.';"
900 L" }" 924 L" }"
901 L" }()" 925 L" }()"
902 L");", 926 L");",
903 &result)); 927 &result));
904 EXPECT_EQ("GOOD: Saw expected error.", result); 928 EXPECT_EQ("GOOD: Saw expected error.", result);
905 } 929 }
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/extensions/subscribe_page_action/subscribe.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698