summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorarv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-19 22:57:33 +0000
committerarv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-19 22:57:33 +0000
commit4b776890339f867a5ad1c946556434730d7ccb9c (patch)
treec6b21cdfe8839506bfbb3d2e35eb3b3228b994fc /chrome/browser
parent19d5175836dbf504a0f09bf75d2ff9c3434262d0 (diff)
downloadchromium_src-4b776890339f867a5ad1c946556434730d7ccb9c.zip
chromium_src-4b776890339f867a5ad1c946556434730d7ccb9c.tar.gz
chromium_src-4b776890339f867a5ad1c946556434730d7ccb9c.tar.bz2
Enable tabbed bookmark manager by default.
Second try with the following changes: - Remove FLAKY_ from Feed tests and makes sure they pass. BUG=4890,38609 TEST=browser_test.exe Run Chrome, Press Ctrl+Shift+B. The new bookmark manager should open in a tab. Review URL: http://codereview.chromium.org/1127006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42165 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/app_controller_mac.mm6
-rw-r--r--chrome/browser/browser.cc6
-rw-r--r--chrome/browser/extensions/browser_action_apitest.cc15
-rw-r--r--chrome/browser/extensions/extension_browsertests_misc.cc50
-rw-r--r--chrome/browser/extensions/extension_crash_recovery_browsertest.cc116
-rw-r--r--chrome/browser/extensions/extension_dom_ui.cc4
-rw-r--r--chrome/browser/extensions/extension_management_tests.cc66
-rw-r--r--chrome/browser/extensions/extension_startup_unittest.cc2
-rw-r--r--chrome/browser/profile.cc4
9 files changed, 147 insertions, 122 deletions
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index d355bcb..d7fa3f7 100644
--- a/chrome/browser/app_controller_mac.mm
+++ b/chrome/browser/app_controller_mac.mm
@@ -678,10 +678,10 @@ void RecordLastRunAppBundlePath() {
// We have no browser window. Only create a window if we are using the
// new tabbed bookmark manager.
if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableTabbedBookmarkManager)) {
- Browser::OpenBookmarkManagerWindow(defaultProfile);
- } else {
+ switches::kDisableTabbedBookmarkManager)) {
[BookmarkManagerController showBookmarkManager:defaultProfile];
+ } else {
+ Browser::OpenBookmarkManagerWindow(defaultProfile);
}
}
break;
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index 42e0834..3b8346d 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -1402,10 +1402,10 @@ void Browser::ToggleExtensionShelf() {
void Browser::OpenBookmarkManager() {
UserMetrics::RecordAction("ShowBookmarkManager", profile_);
if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableTabbedBookmarkManager)) {
- ShowBookmarkManagerTab();
- } else {
+ switches::kDisableTabbedBookmarkManager)) {
window_->ShowBookmarkManager();
+ } else {
+ ShowBookmarkManagerTab();
}
}
diff --git a/chrome/browser/extensions/browser_action_apitest.cc b/chrome/browser/extensions/browser_action_apitest.cc
index b554fa1..a14e7b6 100644
--- a/chrome/browser/extensions/browser_action_apitest.cc
+++ b/chrome/browser/extensions/browser_action_apitest.cc
@@ -309,6 +309,9 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, IncognitoDragging) {
const char kTooltipA[] = "Make this page red";
const char kTooltipB[] = "grow";
const char kTooltipC[] = "Test setPopup()";
+
+ const size_t size_before = service->extensions()->size();
+
ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII(
"browser_action/basics")));
ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII(
@@ -317,15 +320,15 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, IncognitoDragging) {
"browser_action/add_popup")));
// Test that there are 3 browser actions in the toolbar.
- ASSERT_EQ(3u, service->extensions()->size());
+ ASSERT_EQ(size_before + 3, service->extensions()->size());
ASSERT_EQ(3, GetBrowserActionsBar().NumberOfBrowserActions());
// Now enable 2 of the extensions in incognito mode, and test that the browser
// actions show up.
service->extension_prefs()->SetIsIncognitoEnabled(
- service->extensions()->at(0)->id(), true);
+ service->extensions()->at(size_before)->id(), true);
service->extension_prefs()->SetIsIncognitoEnabled(
- service->extensions()->at(2)->id(), true);
+ service->extensions()->at(size_before + 2)->id(), true);
Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile();
Browser* incognito_browser = Browser::Create(incognito_profile);
@@ -349,7 +352,8 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, IncognitoDragging) {
// regular and incognito mode.
// ABC -> CAB
- service->toolbar_model()->MoveBrowserAction(service->extensions()->at(2), 0);
+ service->toolbar_model()->MoveBrowserAction(
+ service->extensions()->at(size_before + 2), 0);
EXPECT_EQ(kTooltipC, GetBrowserActionsBar().GetTooltip(0));
EXPECT_EQ(kTooltipA, GetBrowserActionsBar().GetTooltip(1));
@@ -359,7 +363,8 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, IncognitoDragging) {
EXPECT_EQ(kTooltipA, incognito_bar.GetTooltip(1));
// CAB -> CBA
- service->toolbar_model()->MoveBrowserAction(service->extensions()->at(1), 1);
+ service->toolbar_model()->MoveBrowserAction(
+ service->extensions()->at(size_before + 1), 1);
EXPECT_EQ(kTooltipC, GetBrowserActionsBar().GetTooltip(0));
EXPECT_EQ(kTooltipB, GetBrowserActionsBar().GetTooltip(1));
diff --git a/chrome/browser/extensions/extension_browsertests_misc.cc b/chrome/browser/extensions/extension_browsertests_misc.cc
index dd353b0..5b30bb0 100644
--- a/chrome/browser/extensions/extension_browsertests_misc.cc
+++ b/chrome/browser/extensions/extension_browsertests_misc.cc
@@ -294,14 +294,14 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, RSSMultiRelLink) {
// Tests that tooltips of a browser action icon can be specified using UTF8.
// See http://crbug.com/25349.
IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, TitleLocalizationBrowserAction) {
+ ExtensionsService* service = browser()->profile()->GetExtensionsService();
+ const size_t size_before = service->extensions()->size();
FilePath extension_path(test_data_dir_.AppendASCII("browsertest")
.AppendASCII("title_localized"));
ASSERT_TRUE(LoadExtension(extension_path));
- ExtensionsService* service = browser()->profile()->GetExtensionsService();
- const ExtensionList* extensions = service->extensions();
- ASSERT_EQ(1u, extensions->size());
- Extension* extension = extensions->at(0);
+ ASSERT_EQ(size_before + 1, service->extensions()->size());
+ Extension* extension = service->extensions()->at(size_before);
EXPECT_STREQ(WideToUTF8(L"Hreggvi\u00F0ur: l10n browser action").c_str(),
extension->description().c_str());
@@ -317,6 +317,9 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, TitleLocalizationBrowserAction) {
IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, TitleLocalizationPageAction) {
HTTPTestServer* server = StartHTTPServer();
+ ExtensionsService* service = browser()->profile()->GetExtensionsService();
+ const size_t size_before = service->extensions()->size();
+
FilePath extension_path(test_data_dir_.AppendASCII("browsertest")
.AppendASCII("title_localized_pa"));
ASSERT_TRUE(LoadExtension(extension_path));
@@ -326,10 +329,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, TitleLocalizationPageAction) {
ui_test_utils::NavigateToURL(browser(), url);
ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(1));
- ExtensionsService* service = browser()->profile()->GetExtensionsService();
- const ExtensionList* extensions = service->extensions();
- ASSERT_EQ(1u, extensions->size());
- Extension* extension = extensions->at(0);
+ ASSERT_EQ(size_before + 1, service->extensions()->size());
+ Extension* extension = service->extensions()->at(size_before);
EXPECT_STREQ(WideToUTF8(L"Hreggvi\u00F0ur: l10n page action").c_str(),
extension->description().c_str());
@@ -415,10 +416,8 @@ void NavigateToFeedAndValidate(HTTPTestServer* server,
// TODO(finnur): Implement this is a non-flaky way.
}
- // There should be only one extension in the list (ours). Get its id.
ExtensionsService* service = browser->profile()->GetExtensionsService();
- ASSERT_EQ(1u, service->extensions()->size());
- Extension* extension = (*service->extensions())[0];
+ Extension* extension = service->extensions()->back();
std::string id = extension->id();
// Navigate to the subscribe page directly.
@@ -443,7 +442,7 @@ void NavigateToFeedAndValidate(HTTPTestServer* server,
expected_error));
}
-IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, FLAKY_ParseFeedValidFeed1) {
+IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeed1) {
HTTPTestServer* server = StartHTTPServer();
ASSERT_TRUE(LoadExtension(
@@ -456,7 +455,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, FLAKY_ParseFeedValidFeed1) {
"No error");
}
-IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, FLAKY_ParseFeedValidFeed2) {
+IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeed2) {
HTTPTestServer* server = StartHTTPServer();
ASSERT_TRUE(LoadExtension(
@@ -469,7 +468,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, FLAKY_ParseFeedValidFeed2) {
"No error");
}
-IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, FLAKY_ParseFeedValidFeed3) {
+IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeed3) {
HTTPTestServer* server = StartHTTPServer();
ASSERT_TRUE(LoadExtension(
@@ -482,7 +481,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, FLAKY_ParseFeedValidFeed3) {
"No error");
}
-IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, FLAKY_ParseFeedValidFeed4) {
+IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeed4) {
HTTPTestServer* server = StartHTTPServer();
ASSERT_TRUE(LoadExtension(
@@ -495,7 +494,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, FLAKY_ParseFeedValidFeed4) {
"No error");
}
-IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, FLAKY_ParseFeedValidFeed0) {
+IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeed0) {
HTTPTestServer* server = StartHTTPServer();
ASSERT_TRUE(LoadExtension(
@@ -510,7 +509,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, FLAKY_ParseFeedValidFeed0) {
"No error");
}
-IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, FLAKY_ParseFeedValidFeed5) {
+IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeed5) {
HTTPTestServer* server = StartHTTPServer();
ASSERT_TRUE(LoadExtension(
@@ -524,7 +523,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, FLAKY_ParseFeedValidFeed5) {
"This feed contains no entries.");
}
-IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, FLAKY_ParseFeedInvalidFeed1) {
+IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedInvalidFeed1) {
HTTPTestServer* server = StartHTTPServer();
ASSERT_TRUE(LoadExtension(
@@ -538,7 +537,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, FLAKY_ParseFeedInvalidFeed1) {
"Not a valid feed.");
}
-IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, FLAKY_ParseFeedInvalidFeed2) {
+IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedInvalidFeed2) {
HTTPTestServer* server = StartHTTPServer();
ASSERT_TRUE(LoadExtension(
@@ -552,7 +551,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, FLAKY_ParseFeedInvalidFeed2) {
"Not a valid feed.");
}
-IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, FLAKY_ParseFeedInvalidFeed3) {
+IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedInvalidFeed3) {
HTTPTestServer* server = StartHTTPServer();
ASSERT_TRUE(LoadExtension(
@@ -566,7 +565,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, FLAKY_ParseFeedInvalidFeed3) {
"Not a valid feed.");
}
-IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, FLAKY_ParseFeedValidFeedNoLinks) {
+IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ParseFeedValidFeedNoLinks) {
HTTPTestServer* server = StartHTTPServer();
ASSERT_TRUE(LoadExtension(
@@ -698,8 +697,9 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, MAYBE_PluginLoadUnload) {
EXPECT_FALSE(result);
ExtensionsService* service = browser()->profile()->GetExtensionsService();
+ const size_t size_before = service->extensions()->size();
ASSERT_TRUE(LoadExtension(extension_dir));
- EXPECT_EQ(1u, service->extensions()->size());
+ EXPECT_EQ(size_before + 1, service->extensions()->size());
// Now the plugin should be in the cache, but we have to reload the page for
// it to work.
ui_test_utils::ExecuteJavaScriptAndExtractBool(
@@ -711,9 +711,9 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, MAYBE_PluginLoadUnload) {
tab->render_view_host(), L"", L"testPluginWorks()", &result);
EXPECT_TRUE(result);
- EXPECT_EQ(1u, service->extensions()->size());
- UnloadExtension(service->extensions()->at(0)->id());
- EXPECT_EQ(0u, service->extensions()->size());
+ EXPECT_EQ(size_before + 1, service->extensions()->size());
+ UnloadExtension(service->extensions()->at(size_before)->id());
+ EXPECT_EQ(size_before, service->extensions()->size());
// Now the plugin should be out of the cache again, but existing pages will
// still work until we reload them.
diff --git a/chrome/browser/extensions/extension_crash_recovery_browsertest.cc b/chrome/browser/extensions/extension_crash_recovery_browsertest.cc
index 0bf5815..32b67af 100644
--- a/chrome/browser/extensions/extension_crash_recovery_browsertest.cc
+++ b/chrome/browser/extensions/extension_crash_recovery_browsertest.cc
@@ -82,12 +82,13 @@ class ExtensionCrashRecoveryTest : public ExtensionBrowserTest {
void LoadTestExtension() {
ExtensionBrowserTest::SetUpInProcessBrowserTestFixture();
+ const size_t size_before = GetExtensionsService()->extensions()->size();
ASSERT_TRUE(LoadExtension(
test_data_dir_.AppendASCII("common").AppendASCII("background_page")));
- Extension* extension = GetExtensionsService()->extensions()->at(0);
+ Extension* extension = GetExtensionsService()->extensions()->back();
ASSERT_TRUE(extension);
first_extension_id_ = extension->id();
- CheckExtensionConsistency(0);
+ CheckExtensionConsistency(size_before);
}
void LoadSecondExtension() {
@@ -105,35 +106,38 @@ class ExtensionCrashRecoveryTest : public ExtensionBrowserTest {
};
IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest, Basic) {
+ const size_t size_before = GetExtensionsService()->extensions()->size();
LoadTestExtension();
- CrashExtension(0);
- ASSERT_TRUE(GetExtensionsService()->extensions()->empty());
+ CrashExtension(size_before);
+ ASSERT_EQ(size_before, GetExtensionsService()->extensions()->size());
AcceptCrashedExtensionInfobar(0);
SCOPED_TRACE("after clicking the infobar");
- CheckExtensionConsistency(0);
+ CheckExtensionConsistency(size_before);
}
IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest, CloseAndReload) {
+ const size_t size_before = GetExtensionsService()->extensions()->size();
LoadTestExtension();
- CrashExtension(0);
- ASSERT_TRUE(GetExtensionsService()->extensions()->empty());
+ CrashExtension(size_before);
+ ASSERT_EQ(size_before, GetExtensionsService()->extensions()->size());
CancelCrashedExtensionInfobar(0);
ReloadExtension(first_extension_id_);
SCOPED_TRACE("after reloading");
- CheckExtensionConsistency(0);
+ CheckExtensionConsistency(size_before);
}
IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest, ReloadIndependently) {
+ const size_t size_before = GetExtensionsService()->extensions()->size();
LoadTestExtension();
- CrashExtension(0);
- ASSERT_TRUE(GetExtensionsService()->extensions()->empty());
+ CrashExtension(size_before);
+ ASSERT_EQ(size_before, GetExtensionsService()->extensions()->size());
ReloadExtension(first_extension_id_);
SCOPED_TRACE("after reloading");
- CheckExtensionConsistency(0);
+ CheckExtensionConsistency(size_before);
TabContents* current_tab = browser()->GetSelectedTabContents();
ASSERT_TRUE(current_tab);
@@ -147,77 +151,82 @@ IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest, ReloadIndependently) {
// and close the browser, it doesn't crash. The browser is closed implicitly
// at the end of each browser test.
IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest, ShutdownWhileCrashed) {
+ const size_t size_before = GetExtensionsService()->extensions()->size();
LoadTestExtension();
- CrashExtension(0);
- ASSERT_TRUE(GetExtensionsService()->extensions()->empty());
+ CrashExtension(size_before);
+ ASSERT_EQ(size_before, GetExtensionsService()->extensions()->size());
}
IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest, TwoExtensionsCrashFirst) {
+ const size_t size_before = GetExtensionsService()->extensions()->size();
LoadTestExtension();
LoadSecondExtension();
- CrashExtension(0);
- ASSERT_EQ(1U, GetExtensionsService()->extensions()->size());
+ CrashExtension(size_before);
+ ASSERT_EQ(size_before + 1, GetExtensionsService()->extensions()->size());
AcceptCrashedExtensionInfobar(0);
SCOPED_TRACE("after clicking the infobar");
- CheckExtensionConsistency(0);
- CheckExtensionConsistency(1);
+ CheckExtensionConsistency(size_before);
+ CheckExtensionConsistency(size_before + 1);
}
IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest, TwoExtensionsCrashSecond) {
+ const size_t size_before = GetExtensionsService()->extensions()->size();
LoadTestExtension();
LoadSecondExtension();
- CrashExtension(1);
- ASSERT_EQ(1U, GetExtensionsService()->extensions()->size());
+ CrashExtension(size_before + 1);
+ ASSERT_EQ(size_before + 1, GetExtensionsService()->extensions()->size());
AcceptCrashedExtensionInfobar(0);
SCOPED_TRACE("after clicking the infobar");
- CheckExtensionConsistency(0);
- CheckExtensionConsistency(1);
+ CheckExtensionConsistency(size_before);
+ CheckExtensionConsistency(size_before + 1);
}
IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest,
TwoExtensionsCrashBothAtOnce) {
+ const size_t size_before = GetExtensionsService()->extensions()->size();
LoadTestExtension();
LoadSecondExtension();
- CrashExtension(0);
- ASSERT_EQ(1U, GetExtensionsService()->extensions()->size());
- CrashExtension(0);
- ASSERT_TRUE(GetExtensionsService()->extensions()->empty());
+ CrashExtension(size_before);
+ ASSERT_EQ(size_before + 1, GetExtensionsService()->extensions()->size());
+ CrashExtension(size_before);
+ ASSERT_EQ(size_before, GetExtensionsService()->extensions()->size());
{
SCOPED_TRACE("first infobar");
AcceptCrashedExtensionInfobar(0);
- CheckExtensionConsistency(0);
+ CheckExtensionConsistency(size_before);
}
{
SCOPED_TRACE("second infobar");
AcceptCrashedExtensionInfobar(0);
- CheckExtensionConsistency(0);
- CheckExtensionConsistency(1);
+ CheckExtensionConsistency(size_before);
+ CheckExtensionConsistency(size_before + 1);
}
}
IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest, TwoExtensionsOneByOne) {
+ const size_t size_before = GetExtensionsService()->extensions()->size();
LoadTestExtension();
- CrashExtension(0);
- ASSERT_TRUE(GetExtensionsService()->extensions()->empty());
+ CrashExtension(size_before);
+ ASSERT_EQ(size_before, GetExtensionsService()->extensions()->size());
LoadSecondExtension();
- CrashExtension(0);
- ASSERT_TRUE(GetExtensionsService()->extensions()->empty());
+ CrashExtension(size_before);
+ ASSERT_EQ(size_before, GetExtensionsService()->extensions()->size());
{
SCOPED_TRACE("first infobar");
AcceptCrashedExtensionInfobar(0);
- CheckExtensionConsistency(0);
+ CheckExtensionConsistency(size_before);
}
{
SCOPED_TRACE("second infobar");
AcceptCrashedExtensionInfobar(0);
- CheckExtensionConsistency(0);
- CheckExtensionConsistency(1);
+ CheckExtensionConsistency(size_before);
+ CheckExtensionConsistency(size_before + 1);
}
}
@@ -226,39 +235,42 @@ IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest, TwoExtensionsOneByOne) {
// at the end of each browser test.
IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest,
TwoExtensionsShutdownWhileCrashed) {
+ const size_t size_before = GetExtensionsService()->extensions()->size();
LoadTestExtension();
- CrashExtension(0);
- ASSERT_TRUE(GetExtensionsService()->extensions()->empty());
+ CrashExtension(size_before);
+ ASSERT_EQ(size_before, GetExtensionsService()->extensions()->size());
LoadSecondExtension();
- CrashExtension(0);
- ASSERT_TRUE(GetExtensionsService()->extensions()->empty());
+ CrashExtension(size_before);
+ ASSERT_EQ(size_before, GetExtensionsService()->extensions()->size());
}
IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest,
TwoExtensionsIgnoreFirst) {
+ const size_t size_before = GetExtensionsService()->extensions()->size();
LoadTestExtension();
LoadSecondExtension();
- CrashExtension(0);
- ASSERT_EQ(1U, GetExtensionsService()->extensions()->size());
- CrashExtension(0);
- ASSERT_TRUE(GetExtensionsService()->extensions()->empty());
+ CrashExtension(size_before);
+ ASSERT_EQ(size_before + 1, GetExtensionsService()->extensions()->size());
+ CrashExtension(size_before);
+ ASSERT_EQ(size_before, GetExtensionsService()->extensions()->size());
CancelCrashedExtensionInfobar(0);
AcceptCrashedExtensionInfobar(1);
SCOPED_TRACE("infobars done");
- ASSERT_EQ(1U, GetExtensionsService()->extensions()->size());
- CheckExtensionConsistency(0);
+ ASSERT_EQ(size_before + 1, GetExtensionsService()->extensions()->size());
+ CheckExtensionConsistency(size_before);
}
IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest,
TwoExtensionsReloadIndependently) {
+ const size_t size_before = GetExtensionsService()->extensions()->size();
LoadTestExtension();
LoadSecondExtension();
- CrashExtension(0);
- ASSERT_EQ(1U, GetExtensionsService()->extensions()->size());
- CrashExtension(0);
- ASSERT_TRUE(GetExtensionsService()->extensions()->empty());
+ CrashExtension(size_before);
+ ASSERT_EQ(size_before + 1, GetExtensionsService()->extensions()->size());
+ CrashExtension(size_before);
+ ASSERT_EQ(size_before, GetExtensionsService()->extensions()->size());
{
SCOPED_TRACE("first: reload");
@@ -269,13 +281,13 @@ IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest,
ReloadExtension(first_extension_id_);
// One of the infobars should hide after the extension is reloaded.
ASSERT_EQ(1, current_tab->infobar_delegate_count());
- CheckExtensionConsistency(0);
+ CheckExtensionConsistency(size_before);
}
{
SCOPED_TRACE("second: infobar");
AcceptCrashedExtensionInfobar(0);
- CheckExtensionConsistency(0);
- CheckExtensionConsistency(1);
+ CheckExtensionConsistency(size_before);
+ CheckExtensionConsistency(size_before + 1);
}
}
diff --git a/chrome/browser/extensions/extension_dom_ui.cc b/chrome/browser/extensions/extension_dom_ui.cc
index e9866b1..c3663a0 100644
--- a/chrome/browser/extensions/extension_dom_ui.cc
+++ b/chrome/browser/extensions/extension_dom_ui.cc
@@ -71,8 +71,8 @@ void ExtensionDOMUI::ResetExtensionFunctionDispatcher(
}
void ExtensionDOMUI::ResetExtensionBookmarkManagerEventRouter() {
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableTabbedBookmarkManager)) {
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableTabbedBookmarkManager)) {
extension_bookmark_manager_event_router_.reset(
new ExtensionBookmarkManagerEventRouter(GetProfile(), tab_contents()));
}
diff --git a/chrome/browser/extensions/extension_management_tests.cc b/chrome/browser/extensions/extension_management_tests.cc
index 014677a..5162ebe 100644
--- a/chrome/browser/extensions/extension_management_tests.cc
+++ b/chrome/browser/extensions/extension_management_tests.cc
@@ -49,8 +49,7 @@ class ExtensionManagementTest : public ExtensionBrowserTest {
// the operation was completed successfully.
bool InstallAndUpdateIncreasingPermissionsExtension() {
ExtensionsService* service = browser()->profile()->GetExtensionsService();
- if (service->HasInstalledExtensions())
- return false;
+ size_t size_before = service->extensions()->size();
// Install the initial version, which should happen just fine.
if (!InstallExtension(
@@ -59,13 +58,13 @@ class ExtensionManagementTest : public ExtensionBrowserTest {
// Upgrade to a version that wants more permissions. We should disable the
// extension and prompt the user to reenable.
- if (service->extensions()->size() != 1u)
+ if (service->extensions()->size() != size_before + 1)
return false;
if (!UpdateExtension(
- service->extensions()->at(0)->id(),
+ service->extensions()->at(size_before)->id(),
test_data_dir_.AppendASCII("permissions-high-v2.crx"), -1))
return false;
- EXPECT_EQ(0u, service->extensions()->size());
+ EXPECT_EQ(size_before, service->extensions()->size());
if (service->disabled_extensions()->size() != 1u)
return false;
return true;
@@ -75,7 +74,7 @@ class ExtensionManagementTest : public ExtensionBrowserTest {
// Tests that installing the same version does not overwrite.
IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, InstallSameVersion) {
ExtensionsService* service = browser()->profile()->GetExtensionsService();
- ASSERT_FALSE(service->HasInstalledExtensions());
+ const size_t size_before = service->extensions()->size();
ASSERT_TRUE(InstallExtension(
test_data_dir_.AppendASCII("install/install.crx"), 1));
@@ -83,28 +82,32 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, InstallSameVersion) {
// be kept.
ASSERT_TRUE(InstallExtension(
test_data_dir_.AppendASCII("install/install_same_version.crx"), 0));
- EXPECT_TRUE(IsExtensionAtVersion(service->extensions()->at(0), "1.0"));
+
+ EXPECT_TRUE(IsExtensionAtVersion(service->extensions()->at(size_before),
+ "1.0"));
}
IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, InstallOlderVersion) {
ExtensionsService* service = browser()->profile()->GetExtensionsService();
- ASSERT_FALSE(service->HasInstalledExtensions());
+ const size_t size_before = service->extensions()->size();
ASSERT_TRUE(InstallExtension(
test_data_dir_.AppendASCII("install/install.crx"), 1));
ASSERT_TRUE(InstallExtension(
test_data_dir_.AppendASCII("install/install_older_version.crx"), 0));
- EXPECT_TRUE(IsExtensionAtVersion(service->extensions()->at(0), "1.0"));
+ EXPECT_TRUE(IsExtensionAtVersion(service->extensions()->at(size_before),
+ "1.0"));
}
IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, InstallThenCancel) {
ExtensionsService* service = browser()->profile()->GetExtensionsService();
- ASSERT_FALSE(service->HasInstalledExtensions());
+ const size_t size_before = service->extensions()->size();
ASSERT_TRUE(InstallExtension(
test_data_dir_.AppendASCII("install/install.crx"), 1));
// Cancel this install.
StartInstallButCancel(test_data_dir_.AppendASCII("install/install_v2.crx"));
- EXPECT_TRUE(IsExtensionAtVersion(service->extensions()->at(0), "1.0"));
+ EXPECT_TRUE(IsExtensionAtVersion(service->extensions()->at(size_before),
+ "1.0"));
}
// Tests that installing and uninstalling extensions don't crash with an
@@ -130,10 +133,11 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, Incognito) {
IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, UpdatePermissions) {
ExtensionsService* service = browser()->profile()->GetExtensionsService();
ASSERT_TRUE(InstallAndUpdateIncreasingPermissionsExtension());
+ const size_t size_before = service->extensions()->size();
// Now try reenabling it.
service->EnableExtension(service->disabled_extensions()->at(0)->id());
- EXPECT_EQ(1u, service->extensions()->size());
+ EXPECT_EQ(size_before + 1, service->extensions()->size());
EXPECT_EQ(0u, service->disabled_extensions()->size());
}
@@ -141,12 +145,12 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, UpdatePermissions) {
IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, UninstallDisabled) {
ExtensionsService* service = browser()->profile()->GetExtensionsService();
ASSERT_TRUE(InstallAndUpdateIncreasingPermissionsExtension());
+ const size_t size_before = service->extensions()->size();
// Now try uninstalling it.
UninstallExtension(service->disabled_extensions()->at(0)->id());
- EXPECT_EQ(0u, service->extensions()->size());
+ EXPECT_EQ(size_before, service->extensions()->size());
EXPECT_EQ(0u, service->disabled_extensions()->size());
- ASSERT_FALSE(service->HasInstalledExtensions());
}
// Tests that disabling and re-enabling an extension works.
@@ -154,29 +158,29 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, DisableEnable) {
ExtensionProcessManager* manager = browser()->profile()->
GetExtensionProcessManager();
ExtensionsService* service = browser()->profile()->GetExtensionsService();
+ const size_t size_before = service->extensions()->size();
// Load an extension, expect the background page to be available.
- ASSERT_FALSE(service->HasInstalledExtensions());
ASSERT_TRUE(LoadExtension(
test_data_dir_.AppendASCII("good").AppendASCII("Extensions")
.AppendASCII("bjafgdebaacbbbecmhlhpofkepfkgcpa")
.AppendASCII("1.0")));
- ASSERT_EQ(1u, service->extensions()->size());
+ ASSERT_EQ(size_before + 1, service->extensions()->size());
EXPECT_EQ(0u, service->disabled_extensions()->size());
- Extension* extension = service->extensions()->at(0);
+ Extension* extension = service->extensions()->at(size_before);
EXPECT_TRUE(manager->GetBackgroundHostForExtension(extension));
ASSERT_TRUE(service->HasInstalledExtensions());
// After disabling, the background page should go away.
service->DisableExtension("bjafgdebaacbbbecmhlhpofkepfkgcpa");
- EXPECT_EQ(0u, service->extensions()->size());
+ EXPECT_EQ(size_before, service->extensions()->size());
EXPECT_EQ(1u, service->disabled_extensions()->size());
EXPECT_FALSE(manager->GetBackgroundHostForExtension(extension));
ASSERT_TRUE(service->HasInstalledExtensions());
// And bring it back.
service->EnableExtension("bjafgdebaacbbbecmhlhpofkepfkgcpa");
- EXPECT_EQ(1u, service->extensions()->size());
+ EXPECT_EQ(size_before + 1, service->extensions()->size());
EXPECT_EQ(0u, service->disabled_extensions()->size());
EXPECT_TRUE(manager->GetBackgroundHostForExtension(extension));
ASSERT_TRUE(service->HasInstalledExtensions());
@@ -199,13 +203,15 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, AutoUpdate) {
// Install version 1 of the extension.
ExtensionsService* service = browser()->profile()->GetExtensionsService();
- ASSERT_FALSE(service->HasInstalledExtensions());
+ const size_t size_before = service->extensions()->size();
+ ASSERT_TRUE(service->disabled_extensions()->empty());
ASSERT_TRUE(InstallExtension(basedir.AppendASCII("v1.crx"), 1));
const ExtensionList* extensions = service->extensions();
+ ASSERT_EQ(size_before + 1, extensions->size());
ASSERT_TRUE(service->HasInstalledExtensions());
- ASSERT_EQ(1u, extensions->size());
- ASSERT_EQ("ogjcoiohnmldgjemafoockdghcjciccf", extensions->at(0)->id());
- ASSERT_EQ("1.0", extensions->at(0)->VersionString());
+ ASSERT_EQ("ogjcoiohnmldgjemafoockdghcjciccf",
+ extensions->at(size_before)->id());
+ ASSERT_EQ("1.0", extensions->at(size_before)->VersionString());
// We don't want autoupdate blacklist checks.
service->updater()->set_blacklist_checks_enabled(false);
@@ -214,9 +220,10 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, AutoUpdate) {
service->updater()->CheckNow();
ASSERT_TRUE(WaitForExtensionInstall());
extensions = service->extensions();
- ASSERT_EQ(1u, extensions->size());
- ASSERT_EQ("ogjcoiohnmldgjemafoockdghcjciccf", extensions->at(0)->id());
- ASSERT_EQ("2.0", extensions->at(0)->VersionString());
+ ASSERT_EQ(size_before + 1, extensions->size());
+ ASSERT_EQ("ogjcoiohnmldgjemafoockdghcjciccf",
+ extensions->at(size_before)->id());
+ ASSERT_EQ("2.0", extensions->at(size_before)->VersionString());
// Now try doing an update to version 3, which has been incorrectly
// signed. This should fail.
@@ -230,8 +237,9 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, AutoUpdate) {
// Make sure the extension state is the same as before.
extensions = service->extensions();
- ASSERT_EQ(1u, extensions->size());
- ASSERT_EQ("ogjcoiohnmldgjemafoockdghcjciccf", extensions->at(0)->id());
- ASSERT_EQ("2.0", extensions->at(0)->VersionString());
+ ASSERT_EQ(size_before + 1, extensions->size());
+ ASSERT_EQ("ogjcoiohnmldgjemafoockdghcjciccf",
+ extensions->at(size_before)->id());
+ ASSERT_EQ("2.0", extensions->at(size_before)->VersionString());
}
#endif // !defined(OS_LINUX)
diff --git a/chrome/browser/extensions/extension_startup_unittest.cc b/chrome/browser/extensions/extension_startup_unittest.cc
index 6894b87..4dc6efd 100644
--- a/chrome/browser/extensions/extension_startup_unittest.cc
+++ b/chrome/browser/extensions/extension_startup_unittest.cc
@@ -161,7 +161,7 @@ class ExtensionsStartupTest : public ExtensionStartupTestBase {
};
IN_PROC_BROWSER_TEST_F(ExtensionsStartupTest, Test) {
- WaitForServicesToStart(3, true);
+ WaitForServicesToStart(4, true); // 1 component extension and 3 others.
TestInjection(true, true);
}
diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc
index 2414602..802ad29 100644
--- a/chrome/browser/profile.cc
+++ b/chrome/browser/profile.cc
@@ -676,8 +676,8 @@ void ProfileImpl::InitExtensions() {
true);
// Register the bookmark manager extension.
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableTabbedBookmarkManager)) {
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableTabbedBookmarkManager)) {
FilePath bookmark_manager_path;
if (PathService::Get(chrome::DIR_BOOKMARK_MANAGER,
&bookmark_manager_path)) {