| 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/extension_browsertest.h" | 9 #include "chrome/browser/extensions/extension_browsertest.h" |
| 10 #include "chrome/browser/extensions/extension_host.h" | 10 #include "chrome/browser/extensions/extension_host.h" |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 ui_test_utils::NavigateToURL( | 186 ui_test_utils::NavigateToURL( |
| 187 browser(), | 187 browser(), |
| 188 GURL("chrome-extension://behllobkkfkfnphdnhnkndlbkcpglgmj/page.html")); | 188 GURL("chrome-extension://behllobkkfkfnphdnhnkndlbkcpglgmj/page.html")); |
| 189 result = false; | 189 result = false; |
| 190 ui_test_utils::ExecuteJavaScriptAndExtractBool( | 190 ui_test_utils::ExecuteJavaScriptAndExtractBool( |
| 191 browser()->GetSelectedTabContents()->render_view_host(), L"", | 191 browser()->GetSelectedTabContents()->render_view_host(), L"", |
| 192 L"testTabsAPI()", &result); | 192 L"testTabsAPI()", &result); |
| 193 EXPECT_TRUE(result); | 193 EXPECT_TRUE(result); |
| 194 } | 194 } |
| 195 | 195 |
| 196 #if defined(OS_WIN) | 196 #if defined(OS_WIN) || defined(OS_LINUX) |
| 197 // Tests that we can load page actions in the Omnibox. | 197 // Tests that we can load page actions in the Omnibox. |
| 198 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, PageAction) { | 198 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, PageAction) { |
| 199 ASSERT_TRUE(LoadExtension( | 199 ASSERT_TRUE(LoadExtension( |
| 200 test_data_dir_.AppendASCII("samples") | 200 test_data_dir_.AppendASCII("samples") |
| 201 .AppendASCII("subscribe_page_action"))); | 201 .AppendASCII("subscribe_page_action"))); |
| 202 | 202 |
| 203 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(0)); | 203 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(0)); |
| 204 | 204 |
| 205 // Navigate to the feed page. | 205 // Navigate to the feed page. |
| 206 FilePath test_dir; | 206 FilePath test_dir; |
| 207 PathService::Get(chrome::DIR_TEST_DATA, &test_dir); | 207 PathService::Get(chrome::DIR_TEST_DATA, &test_dir); |
| 208 FilePath feed = test_dir.AppendASCII("feeds") | 208 FilePath feed = test_dir.AppendASCII("feeds") |
| 209 .AppendASCII("feed.html"); | 209 .AppendASCII("feed.html"); |
| 210 | 210 |
| 211 ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(feed)); | 211 ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(feed)); |
| 212 | 212 |
| 213 // We should now have one page action ready to go in the LocationBar. | 213 // We should now have one page action ready to go in the LocationBar. |
| 214 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(1)); | 214 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(1)); |
| 215 | 215 |
| 216 FilePath no_feed = test_dir.AppendASCII("feeds") | 216 FilePath no_feed = test_dir.AppendASCII("feeds") |
| 217 .AppendASCII("nofeed.html"); | 217 .AppendASCII("nofeed.html"); |
| 218 | 218 |
| 219 // Make sure the page action goes away. | 219 // Make sure the page action goes away. |
| 220 ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(no_feed)); | 220 ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(no_feed)); |
| 221 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(0)); | 221 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(0)); |
| 222 } | 222 } |
| 223 #endif // defined(OS_WIN) | 223 #endif // defined(OS_WIN) || defined(OS_LINUX) |
| 224 | 224 |
| 225 GURL GetFeedUrl(const std::string& feed_page) { | 225 GURL GetFeedUrl(const std::string& feed_page) { |
| 226 FilePath test_dir; | 226 FilePath test_dir; |
| 227 PathService::Get(chrome::DIR_TEST_DATA, &test_dir); | 227 PathService::Get(chrome::DIR_TEST_DATA, &test_dir); |
| 228 | 228 |
| 229 FilePath subscribe; | 229 FilePath subscribe; |
| 230 subscribe = test_dir.AppendASCII("extensions") | 230 subscribe = test_dir.AppendASCII("extensions") |
| 231 .AppendASCII("samples") | 231 .AppendASCII("samples") |
| 232 .AppendASCII("subscribe_page_action") | 232 .AppendASCII("subscribe_page_action") |
| 233 .AppendASCII("subscribe.html"); | 233 .AppendASCII("subscribe.html"); |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 browser(), | 596 browser(), |
| 597 GURL("about:blank"), | 597 GURL("about:blank"), |
| 598 "chrome-extension://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/newtab.html"); | 598 "chrome-extension://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/newtab.html"); |
| 599 | 599 |
| 600 // Extension API should fail. | 600 // Extension API should fail. |
| 601 bool result = false; | 601 bool result = false; |
| 602 ui_test_utils::ExecuteJavaScriptAndExtractBool( | 602 ui_test_utils::ExecuteJavaScriptAndExtractBool( |
| 603 newtab->render_view_host(), L"", L"testExtensionApi()", &result); | 603 newtab->render_view_host(), L"", L"testExtensionApi()", &result); |
| 604 EXPECT_FALSE(result); | 604 EXPECT_FALSE(result); |
| 605 } | 605 } |
| OLD | NEW |