| 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/browser_tabstrip.h" | 7 #include "chrome/browser/ui/browser_tabstrip.h" |
| 8 #include "chrome/common/extensions/extension.h" | 8 #include "chrome/common/extensions/extension.h" |
| 9 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
| 10 #include "chrome/test/base/ui_test_utils.h" | 10 #include "chrome/test/base/ui_test_utils.h" |
| 11 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
| 12 #include "content/public/test/browser_test_utils.h" |
| 12 | 13 |
| 13 using content::WebContents; | 14 using content::WebContents; |
| 14 using extensions::Extension; | 15 using extensions::Extension; |
| 15 | 16 |
| 16 namespace { | 17 namespace { |
| 17 | 18 |
| 18 const std::string kSubscribePage = "/subscribe.html"; | 19 const std::string kSubscribePage = "/subscribe.html"; |
| 19 const std::string kFeedPageMultiRel = "files/feeds/feed_multi_rel.html"; | 20 const std::string kFeedPageMultiRel = "files/feeds/feed_multi_rel.html"; |
| 20 const std::string kValidFeedNoLinks = "files/feeds/feed_nolinks.xml"; | 21 const std::string kValidFeedNoLinks = "files/feeds/feed_nolinks.xml"; |
| 21 const std::string kValidFeed0 = "files/feeds/feed_script.xml"; | 22 const std::string kValidFeed0 = "files/feeds/feed_script.xml"; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 } | 75 } |
| 75 } | 76 } |
| 76 | 77 |
| 77 bool ValidatePageElement(WebContents* tab, | 78 bool ValidatePageElement(WebContents* tab, |
| 78 const std::wstring& frame, | 79 const std::wstring& frame, |
| 79 const std::wstring& javascript, | 80 const std::wstring& javascript, |
| 80 const std::string& expected_value) { | 81 const std::string& expected_value) { |
| 81 std::string returned_value; | 82 std::string returned_value; |
| 82 std::string error; | 83 std::string error; |
| 83 | 84 |
| 84 if (!ui_test_utils::ExecuteJavaScriptAndExtractString( | 85 if (!content::ExecuteJavaScriptAndExtractString( |
| 85 tab->GetRenderViewHost(), | 86 tab->GetRenderViewHost(), |
| 86 frame, | 87 frame, |
| 87 javascript, &returned_value)) | 88 javascript, &returned_value)) |
| 88 return false; | 89 return false; |
| 89 | 90 |
| 90 EXPECT_STREQ(expected_value.c_str(), returned_value.c_str()); | 91 EXPECT_STREQ(expected_value.c_str(), returned_value.c_str()); |
| 91 return expected_value == returned_value; | 92 return expected_value == returned_value; |
| 92 } | 93 } |
| 93 | 94 |
| 94 // 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 |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 std::string id = extension->id(); | 340 std::string id = extension->id(); |
| 340 | 341 |
| 341 // Valid feed but containing no links. | 342 // Valid feed but containing no links. |
| 342 NavigateToFeedAndValidate( | 343 NavigateToFeedAndValidate( |
| 343 test_server(), kValidFeedNoLinks, browser(), id, true, | 344 test_server(), kValidFeedNoLinks, browser(), id, true, |
| 344 "Feed for MyFeedTitle", | 345 "Feed for MyFeedTitle", |
| 345 "Title with no link", | 346 "Title with no link", |
| 346 "Desc", | 347 "Desc", |
| 347 "No error"); | 348 "No error"); |
| 348 } | 349 } |
| OLD | NEW |