Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6253)

Unified Diff: chrome/browser/extensions/extension_startup_unittest.cc

Issue 150213: Add a ExtensionBrowserTest base class (Closed)
Patch Set: added timeouts fixed other tests Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_startup_unittest.cc
diff --git a/chrome/browser/extensions/extension_startup_unittest.cc b/chrome/browser/extensions/extension_startup_unittest.cc
index a9c494aebe427c5d6635e6be5dd58534fb1b1ab6..540671e154dee3b35669a8296f7d757e4d207436 100644
--- a/chrome/browser/extensions/extension_startup_unittest.cc
+++ b/chrome/browser/extensions/extension_startup_unittest.cc
@@ -7,6 +7,7 @@
#include "chrome/browser/browser.h"
#include "chrome/browser/extensions/extensions_service.h"
#include "chrome/browser/profile.h"
+#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/notification_details.h"
@@ -18,22 +19,22 @@
#include "chrome/test/ui_test_utils.h"
#include "net/base/net_util.h"
-// This file contains high-level regression tests for the extensions system. The
-// goal here is not to test everything in depth, but to run the system as close
-// as possible end-to-end to find any gaps in test coverage in the lower-level
-// unit tests.
+// This file contains high-level startup tests for the extensions system. We've
+// had many silly bugs where command line flags did not get propagated correctly
+// into the services, so we didn't start correctly.
class ExtensionStartupTestBase
: public InProcessBrowserTest, public NotificationObserver {
public:
ExtensionStartupTestBase()
: enable_extensions_(false), enable_user_scripts_(false) {
- EnableDOMAutomation();
}
protected:
// InProcessBrowserTest
virtual void SetUpCommandLine(CommandLine* command_line) {
+ EnableDOMAutomation();
+
FilePath profile_dir;
PathService::Get(chrome::DIR_USER_DATA, &profile_dir);
profile_dir = profile_dir.AppendASCII("Default");
@@ -145,7 +146,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionsStartupTest, Test) {
// Test that the content script ran.
bool result = false;
ui_test_utils::ExecuteJavaScriptAndExtractBool(
- browser()->GetSelectedTabContents(), L"",
+ browser()->GetSelectedTabContents()->render_view_host(), L"",
L"window.domAutomationController.send("
L"document.defaultView.getComputedStyle(document.body, null)."
L"getPropertyValue('background-color') == 'rgb(245, 245, 220)')",
@@ -154,21 +155,10 @@ IN_PROC_BROWSER_TEST_F(ExtensionsStartupTest, Test) {
result = false;
ui_test_utils::ExecuteJavaScriptAndExtractBool(
- browser()->GetSelectedTabContents(), L"",
+ browser()->GetSelectedTabContents()->render_view_host(), L"",
L"window.domAutomationController.send(document.title == 'Modified')",
&result);
EXPECT_TRUE(result);
-
- // Load an extension page into the tab area to make sure it works.
- result = false;
- ui_test_utils::NavigateToURL(
- browser(),
- GURL("chrome-extension://behllobkkfkfnphdnhnkndlbkcpglgmj/page.html"));
- ui_test_utils::ExecuteJavaScriptAndExtractBool(
- browser()->GetSelectedTabContents(), L"", L"testTabsAPI()", &result);
- EXPECT_TRUE(result);
-
- // TODO(aa): Move the stuff in ExtensionBrowserTest here?
}
@@ -207,7 +197,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionsStartupUserScriptTest, Test) {
// Test that the user script ran.
bool result = false;
ui_test_utils::ExecuteJavaScriptAndExtractBool(
- browser()->GetSelectedTabContents(), L"",
+ browser()->GetSelectedTabContents()->render_view_host(), L"",
L"window.domAutomationController.send(document.title == 'Modified')",
&result);
EXPECT_TRUE(result);
« no previous file with comments | « chrome/browser/extensions/extension_shelf_model_unittest.cc ('k') | chrome/browser/extensions/extensions_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698