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 |
92 // Test for compact language detection API. First navigate to a (static) html | 95 // Test for compact language detection API. First navigate to a (static) html |
93 // file with a French sentence. Then, run the test API in toolstrip1.html to | 96 // file with a French sentence. Then, run the test API in toolstrip1.html to |
94 // actually call the language detection API through the existing extension, | 97 // actually call the language detection API through the existing extension, |
95 // and verify that the language returned is indeed French. | 98 // and verify that the language returned is indeed French. |
96 FilePath language_url = extension_test_data_dir.AppendASCII( | 99 FilePath language_url = extension_test_data_dir.AppendASCII( |
97 "french_sentence.html"); | 100 "french_sentence.html"); |
98 ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(language_url)); | 101 ui_test_utils::NavigateToURL( |
| 102 browser(), |
| 103 GURL(language_url.ToWStringHack())); |
99 | 104 |
100 ui_test_utils::ExecuteJavaScriptAndExtractBool( | 105 ui_test_utils::ExecuteJavaScriptAndExtractBool( |
101 host->render_view_host(), L"", L"testTabsLanguageAPI()", &result); | 106 host->render_view_host(), L"", L"testTabsLanguageAPI()", &result); |
102 EXPECT_TRUE(result); | 107 EXPECT_TRUE(result); |
| 108 #endif |
103 } | 109 } |
104 | 110 |
105 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ExtensionViews) { | 111 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ExtensionViews) { |
106 FilePath extension_test_data_dir = test_data_dir_.AppendASCII("good"). | 112 FilePath extension_test_data_dir = test_data_dir_.AppendASCII("good"). |
107 AppendASCII("Extensions").AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj"). | 113 AppendASCII("Extensions").AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj"). |
108 AppendASCII("1.0.0.0"); | 114 AppendASCII("1.0.0.0"); |
109 ASSERT_TRUE(LoadExtension(extension_test_data_dir)); | 115 ASSERT_TRUE(LoadExtension(extension_test_data_dir)); |
110 | 116 |
111 // At this point, there should be three ExtensionHosts loaded because this | 117 // At this point, there should be three ExtensionHosts loaded because this |
112 // extension has two toolstrips and one background page. Find the one that is | 118 // 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... |
806 | 812 |
807 // If the options page hasn't already come up, wait for it. | 813 // If the options page hasn't already come up, wait for it. |
808 if (tab_strip->count() == 1) { | 814 if (tab_strip->count() == 1) { |
809 ui_test_utils::WaitForNewTab(browser()); | 815 ui_test_utils::WaitForNewTab(browser()); |
810 } | 816 } |
811 ASSERT_EQ(2, tab_strip->count()); | 817 ASSERT_EQ(2, tab_strip->count()); |
812 | 818 |
813 EXPECT_EQ(extension->GetResourceURL("options.html"), | 819 EXPECT_EQ(extension->GetResourceURL("options.html"), |
814 tab_strip->GetTabContentsAt(1)->GetURL()); | 820 tab_strip->GetTabContentsAt(1)->GetURL()); |
815 } | 821 } |
OLD | NEW |