Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 122 ASSERT_TRUE(LoadExtension( | 122 ASSERT_TRUE(LoadExtension( |
| 123 test_data_dir_.AppendASCII("good").AppendASCII("Extensions") | 123 test_data_dir_.AppendASCII("good").AppendASCII("Extensions") |
| 124 .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj") | 124 .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj") |
| 125 .AppendASCII("1.0.0.0"))); | 125 .AppendASCII("1.0.0.0"))); |
| 126 | 126 |
| 127 ExtensionProcessManager* manager = | 127 ExtensionProcessManager* manager = |
| 128 browser()->profile()->GetExtensionProcessManager(); | 128 browser()->profile()->GetExtensionProcessManager(); |
| 129 ExtensionHost* host = FindHostWithPath(manager, "/backgroundpage.html", 1); | 129 ExtensionHost* host = FindHostWithPath(manager, "/backgroundpage.html", 1); |
| 130 WebPreferences prefs = | 130 WebPreferences prefs = |
| 131 host->render_view_host()->GetDelegate()->GetWebkitPrefs(); | 131 host->render_view_host()->GetDelegate()->GetWebkitPrefs(); |
| 132 ASSERT_FALSE(prefs.experimental_webgl_enabled); | 132 ASSERT_TRUE(prefs.experimental_webgl_enabled); |
| 133 ASSERT_FALSE(prefs.accelerated_compositing_enabled); | 133 ASSERT_TRUE(prefs.accelerated_compositing_enabled); |
| 134 ASSERT_FALSE(prefs.accelerated_2d_canvas_enabled); | 134 ASSERT_TRUE(prefs.accelerated_2d_canvas_enabled); |
| 135 } | 135 } |
| 136 | 136 |
| 137 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, PageActionCrash25562) { | 137 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, PageActionCrash25562) { |
| 138 ASSERT_TRUE(test_server()->Start()); | 138 ASSERT_TRUE(test_server()->Start()); |
| 139 | 139 |
| 140 CommandLine::ForCurrentProcess()->AppendSwitch( | 140 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 141 switches::kAllowLegacyExtensionManifests); | 141 switches::kAllowLegacyExtensionManifests); |
| 142 | 142 |
| 143 // This page action will not show an icon, since it doesn't specify one but | 143 // This page action will not show an icon, since it doesn't specify one but |
| 144 // is included here to test for a crash (http://crbug.com/25562). | 144 // is included here to test for a crash (http://crbug.com/25562). |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 690 ExtensionProcessManager* manager = | 690 ExtensionProcessManager* manager = |
| 691 browser()->profile()->GetExtensionProcessManager(); | 691 browser()->profile()->GetExtensionProcessManager(); |
| 692 ExtensionHost* host = FindHostWithPath(manager, "/bg.html", 1); | 692 ExtensionHost* host = FindHostWithPath(manager, "/bg.html", 1); |
| 693 | 693 |
| 694 bool result = false; | 694 bool result = false; |
| 695 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 695 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
| 696 host->render_view_host(), L"", L"testLastError()", &result)); | 696 host->render_view_host(), L"", L"testLastError()", &result)); |
| 697 EXPECT_TRUE(result); | 697 EXPECT_TRUE(result); |
| 698 } | 698 } |
| 699 | 699 |
| 700 // Tests to make sure we can use Canvas2D from a background page | |
| 701 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, Canvas2D) { | |
|
Aaron Boodman
2012/03/09 01:00:06
Did you see the note at the bottom of the file (do
Josh Horwich
2012/03/09 01:21:56
Didn't see the note.
Do you mean app_background_p
Josh Horwich
2012/03/09 02:26:25
Done.
| |
| 702 ASSERT_TRUE(LoadExtension( | |
| 703 test_data_dir_.AppendASCII("canvas"))); | |
| 704 | |
| 705 // Get the ExtensionHost that is hosting our background page. | |
| 706 ExtensionProcessManager* manager = | |
| 707 browser()->profile()->GetExtensionProcessManager(); | |
| 708 ExtensionHost* host = FindHostWithPath(manager, "/background.html", 1); | |
| 709 | |
| 710 bool result = false; | |
| 711 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | |
| 712 host->render_view_host(), L"", L"test()", &result)); | |
| 713 EXPECT_TRUE(result); | |
| 714 } | |
| 715 | |
| 700 // Helper function for common code shared by the 3 WindowOpen tests below. | 716 // Helper function for common code shared by the 3 WindowOpen tests below. |
| 701 static void WindowOpenHelper(Browser* browser, const GURL& start_url, | 717 static void WindowOpenHelper(Browser* browser, const GURL& start_url, |
| 702 const std::string& newtab_url, | 718 const std::string& newtab_url, |
| 703 WebContents** newtab_result) { | 719 WebContents** newtab_result) { |
| 704 ui_test_utils::NavigateToURL(browser, start_url); | 720 ui_test_utils::NavigateToURL(browser, start_url); |
| 705 | 721 |
| 706 ui_test_utils::WindowedNotificationObserver observer( | 722 ui_test_utils::WindowedNotificationObserver observer( |
| 707 content::NOTIFICATION_LOAD_STOP, | 723 content::NOTIFICATION_LOAD_STOP, |
| 708 content::NotificationService::AllSources()); | 724 content::NotificationService::AllSources()); |
| 709 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( | 725 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 924 | 940 |
| 925 EXPECT_EQ(extension->GetResourceURL("options.html"), | 941 EXPECT_EQ(extension->GetResourceURL("options.html"), |
| 926 tab_strip->GetTabContentsAt(1)->web_contents()->GetURL()); | 942 tab_strip->GetTabContentsAt(1)->web_contents()->GetURL()); |
| 927 } | 943 } |
| 928 | 944 |
| 929 //============================================================================== | 945 //============================================================================== |
| 930 // STOP! Please do not add any more random-ass tests here. Create new files for | 946 // STOP! Please do not add any more random-ass tests here. Create new files for |
| 931 // your tests grouped by functionality. Also, you should strongly consider using | 947 // your tests grouped by functionality. Also, you should strongly consider using |
| 932 // ExtensionAPITest if possible. | 948 // ExtensionAPITest if possible. |
| 933 //============================================================================== | 949 //============================================================================== |
| OLD | NEW |