| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/ref_counted.h" | 5 #include "base/ref_counted.h" |
| 6 #include "chrome/browser/browser.h" | 6 #include "chrome/browser/browser.h" |
| 7 #include "chrome/browser/browser_list.h" | 7 #include "chrome/browser/browser_list.h" |
| 8 #include "chrome/browser/renderer_host/render_view_host.h" | 8 #include "chrome/browser/renderer_host/render_view_host.h" |
| 9 #include "chrome/browser/extensions/autoupdate_interceptor.h" | 9 #include "chrome/browser/extensions/autoupdate_interceptor.h" |
| 10 #include "chrome/browser/extensions/extension_browsertest.h" | 10 #include "chrome/browser/extensions/extension_browsertest.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 ExtensionProcessManager* manager = | 82 ExtensionProcessManager* manager = |
| 83 browser()->profile()->GetExtensionProcessManager(); | 83 browser()->profile()->GetExtensionProcessManager(); |
| 84 ExtensionHost* host = FindHostWithPath(manager, "/toolstrip1.html", 3); | 84 ExtensionHost* host = FindHostWithPath(manager, "/toolstrip1.html", 3); |
| 85 | 85 |
| 86 // Tell it to run some JavaScript that tests that basic extension code works. | 86 // Tell it to run some JavaScript that tests that basic extension code works. |
| 87 bool result = false; | 87 bool result = false; |
| 88 ui_test_utils::ExecuteJavaScriptAndExtractBool( | 88 ui_test_utils::ExecuteJavaScriptAndExtractBool( |
| 89 host->render_view_host(), L"", L"testTabsAPI()", &result); | 89 host->render_view_host(), L"", L"testTabsAPI()", &result); |
| 90 EXPECT_TRUE(result); | 90 EXPECT_TRUE(result); |
| 91 | 91 |
| 92 #if defined(OS_WIN) | |
| 93 // http://crbug.com/29896 - tabs.detectLanguage is Windows only | |
| 94 | |
| 95 // Test for compact language detection API. First navigate to a (static) html | 92 // Test for compact language detection API. First navigate to a (static) html |
| 96 // file with a French sentence. Then, run the test API in toolstrip1.html to | 93 // file with a French sentence. Then, run the test API in toolstrip1.html to |
| 97 // actually call the language detection API through the existing extension, | 94 // actually call the language detection API through the existing extension, |
| 98 // and verify that the language returned is indeed French. | 95 // and verify that the language returned is indeed French. |
| 99 FilePath language_url = extension_test_data_dir.AppendASCII( | 96 FilePath language_url = extension_test_data_dir.AppendASCII( |
| 100 "french_sentence.html"); | 97 "french_sentence.html"); |
| 101 ui_test_utils::NavigateToURL( | 98 ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(language_url)); |
| 102 browser(), | |
| 103 GURL(language_url.ToWStringHack())); | |
| 104 | 99 |
| 105 ui_test_utils::ExecuteJavaScriptAndExtractBool( | 100 ui_test_utils::ExecuteJavaScriptAndExtractBool( |
| 106 host->render_view_host(), L"", L"testTabsLanguageAPI()", &result); | 101 host->render_view_host(), L"", L"testTabsLanguageAPI()", &result); |
| 107 EXPECT_TRUE(result); | 102 EXPECT_TRUE(result); |
| 108 #endif | |
| 109 } | 103 } |
| 110 | 104 |
| 111 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ExtensionViews) { | 105 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ExtensionViews) { |
| 112 FilePath extension_test_data_dir = test_data_dir_.AppendASCII("good"). | 106 FilePath extension_test_data_dir = test_data_dir_.AppendASCII("good"). |
| 113 AppendASCII("Extensions").AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj"). | 107 AppendASCII("Extensions").AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj"). |
| 114 AppendASCII("1.0.0.0"); | 108 AppendASCII("1.0.0.0"); |
| 115 ASSERT_TRUE(LoadExtension(extension_test_data_dir)); | 109 ASSERT_TRUE(LoadExtension(extension_test_data_dir)); |
| 116 | 110 |
| 117 // At this point, there should be three ExtensionHosts loaded because this | 111 // At this point, there should be three ExtensionHosts loaded because this |
| 118 // extension has two toolstrips and one background page. Find the one that is | 112 // extension has two toolstrips and one background page. Find the one that is |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 | 806 |
| 813 // If the options page hasn't already come up, wait for it. | 807 // If the options page hasn't already come up, wait for it. |
| 814 if (tab_strip->count() == 1) { | 808 if (tab_strip->count() == 1) { |
| 815 ui_test_utils::WaitForNewTab(browser()); | 809 ui_test_utils::WaitForNewTab(browser()); |
| 816 } | 810 } |
| 817 ASSERT_EQ(2, tab_strip->count()); | 811 ASSERT_EQ(2, tab_strip->count()); |
| 818 | 812 |
| 819 EXPECT_EQ(extension->GetResourceURL("options.html"), | 813 EXPECT_EQ(extension->GetResourceURL("options.html"), |
| 820 tab_strip->GetTabContentsAt(1)->GetURL()); | 814 tab_strip->GetTabContentsAt(1)->GetURL()); |
| 821 } | 815 } |
| OLD | NEW |