| 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/extensions/extension_action.h" | 23 #include "chrome/common/extensions/extension_action.h" |
| 24 #include "chrome/common/url_constants.h" | 24 #include "chrome/common/url_constants.h" |
| 25 #include "chrome/test/base/ui_test_utils.h" | 25 #include "chrome/test/base/ui_test_utils.h" |
| 26 #include "content/browser/renderer_host/render_view_host.h" | 26 #include "content/browser/renderer_host/render_view_host.h" |
| 27 #include "content/browser/site_instance.h" | 27 #include "content/browser/site_instance.h" |
| 28 #include "content/browser/tab_contents/tab_contents.h" | 28 #include "content/browser/tab_contents/tab_contents.h" |
| 29 #include "content/public/browser/notification_service.h" |
| 29 #include "net/base/net_util.h" | 30 #include "net/base/net_util.h" |
| 30 #include "net/test/test_server.h" | 31 #include "net/test/test_server.h" |
| 31 | 32 |
| 32 #if defined(TOOLKIT_VIEWS) | 33 #if defined(TOOLKIT_VIEWS) |
| 33 #include "chrome/browser/ui/views/frame/browser_view.h" | 34 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 34 #endif | 35 #endif |
| 35 | 36 |
| 36 const std::string kSubscribePage = "/subscribe.html"; | 37 const std::string kSubscribePage = "/subscribe.html"; |
| 37 const std::string kFeedPage = "files/feeds/feed.html"; | 38 const std::string kFeedPage = "files/feeds/feed.html"; |
| 38 const std::string kFeedPageMultiRel = "files/feeds/feed_multi_rel.html"; | 39 const std::string kFeedPageMultiRel = "files/feeds/feed_multi_rel.html"; |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 } | 608 } |
| 608 | 609 |
| 609 // Helper function for common code shared by the 3 WindowOpen tests below. | 610 // Helper function for common code shared by the 3 WindowOpen tests below. |
| 610 static void WindowOpenHelper(Browser* browser, const GURL& start_url, | 611 static void WindowOpenHelper(Browser* browser, const GURL& start_url, |
| 611 const std::string& newtab_url, | 612 const std::string& newtab_url, |
| 612 TabContents** newtab_result) { | 613 TabContents** newtab_result) { |
| 613 ui_test_utils::NavigateToURL(browser, start_url); | 614 ui_test_utils::NavigateToURL(browser, start_url); |
| 614 | 615 |
| 615 ui_test_utils::WindowedNotificationObserver observer( | 616 ui_test_utils::WindowedNotificationObserver observer( |
| 616 content::NOTIFICATION_LOAD_STOP, | 617 content::NOTIFICATION_LOAD_STOP, |
| 617 NotificationService::AllSources()); | 618 content::NotificationService::AllSources()); |
| 618 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( | 619 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( |
| 619 browser->GetSelectedTabContents()->render_view_host(), L"", | 620 browser->GetSelectedTabContents()->render_view_host(), L"", |
| 620 L"window.open('" + UTF8ToWide(newtab_url) + L"');")); | 621 L"window.open('" + UTF8ToWide(newtab_url) + L"');")); |
| 621 | 622 |
| 622 // Now the active tab in last active window should be the new tab. | 623 // Now the active tab in last active window should be the new tab. |
| 623 Browser* last_active_browser = BrowserList::GetLastActive(); | 624 Browser* last_active_browser = BrowserList::GetLastActive(); |
| 624 EXPECT_TRUE(last_active_browser); | 625 EXPECT_TRUE(last_active_browser); |
| 625 TabContents* newtab = last_active_browser->GetSelectedTabContents(); | 626 TabContents* newtab = last_active_browser->GetSelectedTabContents(); |
| 626 EXPECT_TRUE(newtab); | 627 EXPECT_TRUE(newtab); |
| 627 GURL expected_url = start_url.Resolve(newtab_url); | 628 GURL expected_url = start_url.Resolve(newtab_url); |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 | 844 |
| 844 EXPECT_EQ(extension->GetResourceURL("options.html"), | 845 EXPECT_EQ(extension->GetResourceURL("options.html"), |
| 845 tab_strip->GetTabContentsAt(1)->tab_contents()->GetURL()); | 846 tab_strip->GetTabContentsAt(1)->tab_contents()->GetURL()); |
| 846 } | 847 } |
| 847 | 848 |
| 848 //============================================================================== | 849 //============================================================================== |
| 849 // STOP! Please do not add any more random-ass tests here. Create new files for | 850 // STOP! Please do not add any more random-ass tests here. Create new files for |
| 850 // your tests grouped by functionality. Also, you should strongly consider using | 851 // your tests grouped by functionality. Also, you should strongly consider using |
| 851 // ExtensionAPITest if possible. | 852 // ExtensionAPITest if possible. |
| 852 //============================================================================== | 853 //============================================================================== |
| OLD | NEW |