| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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" |
| 11 #include "chrome/browser/extensions/extension_browsertest.h" | 11 #include "chrome/browser/extensions/extension_browsertest.h" |
| 12 #include "chrome/browser/extensions/extension_error_reporter.h" | 12 #include "chrome/browser/extensions/extension_error_reporter.h" |
| 13 #include "chrome/browser/extensions/extension_host.h" | 13 #include "chrome/browser/extensions/extension_host.h" |
| 14 #include "chrome/browser/extensions/extension_process_manager.h" | 14 #include "chrome/browser/extensions/extension_process_manager.h" |
| 15 #include "chrome/browser/extensions/extension_tabs_module.h" | 15 #include "chrome/browser/extensions/extension_tabs_module.h" |
| 16 #include "chrome/browser/extensions/extensions_service.h" | 16 #include "chrome/browser/extensions/extensions_service.h" |
| 17 #include "chrome/browser/extensions/extension_updater.h" | 17 #include "chrome/browser/extensions/extension_updater.h" |
| 18 #include "chrome/browser/profile.h" | 18 #include "chrome/browser/profile.h" |
| 19 #include "chrome/browser/renderer_host/render_view_host.h" | 19 #include "chrome/browser/renderer_host/render_view_host.h" |
| 20 #include "chrome/browser/renderer_host/site_instance.h" | 20 #include "chrome/browser/renderer_host/site_instance.h" |
| 21 #include "chrome/browser/tab_contents/tab_contents.h" | 21 #include "chrome/browser/tab_contents/tab_contents.h" |
| 22 #include "chrome/browser/tab_contents_wrapper.h" |
| 22 #include "chrome/browser/tabs/tab_strip_model.h" | 23 #include "chrome/browser/tabs/tab_strip_model.h" |
| 23 #include "chrome/browser/ui/browser.h" | 24 #include "chrome/browser/ui/browser.h" |
| 24 #include "chrome/common/chrome_paths.h" | 25 #include "chrome/common/chrome_paths.h" |
| 25 #include "chrome/common/extensions/extension_action.h" | 26 #include "chrome/common/extensions/extension_action.h" |
| 26 #include "chrome/common/notification_service.h" | 27 #include "chrome/common/notification_service.h" |
| 27 #include "chrome/common/url_constants.h" | 28 #include "chrome/common/url_constants.h" |
| 28 #include "chrome/test/ui_test_utils.h" | 29 #include "chrome/test/ui_test_utils.h" |
| 29 #include "net/base/mock_host_resolver.h" | 30 #include "net/base/mock_host_resolver.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" |
| (...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 browser()->GetSelectedTabContents()->render_view_host(), L"", | 788 browser()->GetSelectedTabContents()->render_view_host(), L"", |
| 788 jscript_click_option_button)); | 789 jscript_click_option_button)); |
| 789 | 790 |
| 790 // If the options page hasn't already come up, wait for it. | 791 // If the options page hasn't already come up, wait for it. |
| 791 if (tab_strip->count() == 1) { | 792 if (tab_strip->count() == 1) { |
| 792 ui_test_utils::WaitForNewTab(browser()); | 793 ui_test_utils::WaitForNewTab(browser()); |
| 793 } | 794 } |
| 794 ASSERT_EQ(2, tab_strip->count()); | 795 ASSERT_EQ(2, tab_strip->count()); |
| 795 | 796 |
| 796 EXPECT_EQ(extension->GetResourceURL("options.html"), | 797 EXPECT_EQ(extension->GetResourceURL("options.html"), |
| 797 tab_strip->GetTabContentsAt(1)->GetURL()); | 798 tab_strip->GetTabContentsAt(1)->tab_contents()->GetURL()); |
| 798 } | 799 } |
| 799 | 800 |
| 800 // Test window.chrome.app.isInstalled . | 801 // Test window.chrome.app.isInstalled . |
| 801 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, PropertyAppIsInstalled) { | 802 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, PropertyAppIsInstalled) { |
| 802 std::string app_host("app.com"); | 803 std::string app_host("app.com"); |
| 803 std::string nonapp_host("nonapp.com"); | 804 std::string nonapp_host("nonapp.com"); |
| 804 | 805 |
| 805 host_resolver()->AddRule(app_host, "127.0.0.1"); | 806 host_resolver()->AddRule(app_host, "127.0.0.1"); |
| 806 host_resolver()->AddRule(nonapp_host, "127.0.0.1"); | 807 host_resolver()->AddRule(nonapp_host, "127.0.0.1"); |
| 807 ASSERT_TRUE(test_server()->Start()); | 808 ASSERT_TRUE(test_server()->Start()); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 L" window.chrome.app.isInstalled = false;" | 859 L" window.chrome.app.isInstalled = false;" |
| 859 L" return 'BAD: Should have thrown by now...';" | 860 L" return 'BAD: Should have thrown by now...';" |
| 860 L" } catch (e) {" | 861 L" } catch (e) {" |
| 861 L" return 'GOOD: Saw expected error.';" | 862 L" return 'GOOD: Saw expected error.';" |
| 862 L" }" | 863 L" }" |
| 863 L" }()" | 864 L" }()" |
| 864 L");", | 865 L");", |
| 865 &result)); | 866 &result)); |
| 866 EXPECT_EQ("GOOD: Saw expected error.", result); | 867 EXPECT_EQ("GOOD: Saw expected error.", result); |
| 867 } | 868 } |
| OLD | NEW |