summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorandybons@chromium.org <andybons@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-19 14:57:43 +0000
committerandybons@chromium.org <andybons@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-19 14:57:43 +0000
commite685fc4178818c026f1498461edb3f2bfeff5722 (patch)
treef22c6b9ea815d822e0bb60d4c83208547b935401 /chrome/browser
parent6c077af5c79a85d64e4b4363b8d0e29bb16543db (diff)
downloadchromium_src-e685fc4178818c026f1498461edb3f2bfeff5722.zip
chromium_src-e685fc4178818c026f1498461edb3f2bfeff5722.tar.gz
chromium_src-e685fc4178818c026f1498461edb3f2bfeff5722.tar.bz2
Revert 42061 - Enable tabbed bookmark manager by default due to browser_tests and chrome frame breaking.
BUG=4890 TEST=None Review URL: http://codereview.chromium.org/1139001 TBR=arv@chromium.org Review URL: http://codereview.chromium.org/1146004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42103 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.cc26
-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, 109 insertions, 136 deletions
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index d7fa3f7..d355bcb 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::kDisableTabbedBookmarkManager)) {
- [BookmarkManagerController showBookmarkManager:defaultProfile];
- } else {
+ switches::kEnableTabbedBookmarkManager)) {
Browser::OpenBookmarkManagerWindow(defaultProfile);
+ } else {
+ [BookmarkManagerController showBookmarkManager:defaultProfile];
}
}
break;
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index f2779af..378d86e 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -1401,10 +1401,10 @@ void Browser::ToggleExtensionShelf() {
void Browser::OpenBookmarkManager() {
UserMetrics::RecordAction("ShowBookmarkManager", profile_);
if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kDisableTabbedBookmarkManager)) {
- window_->ShowBookmarkManager();
- } else {
+ switches::kEnableTabbedBookmarkManager)) {
ShowBookmarkManagerTab();
+ } else {
+ window_->ShowBookmarkManager();
}
}
diff --git a/chrome/browser/extensions/browser_action_apitest.cc b/chrome/browser/extensions/browser_action_apitest.cc
index a14e7b6..b554fa1 100644
--- a/chrome/browser/extensions/browser_action_apitest.cc
+++ b/chrome/browser/extensions/browser_action_apitest.cc
@@ -309,9 +309,6 @@ 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(
@@ -320,15 +317,15 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, IncognitoDragging) {
"browser_action/add_popup")));
// Test that there are 3 browser actions in the toolbar.
- ASSERT_EQ(size_before + 3, service->extensions()->size());
+ ASSERT_EQ(3u, 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(size_before)->id(), true);
+ service->extensions()->at(0)->id(), true);
service->extension_prefs()->SetIsIncognitoEnabled(
- service->extensions()->at(size_before + 2)->id(), true);
+ service->extensions()->at(2)->id(), true);
Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile();
Browser* incognito_browser = Browser::Create(incognito_profile);
@@ -352,8 +349,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, IncognitoDragging) {
// regular and incognito mode.
// ABC -> CAB
- service->toolbar_model()->MoveBrowserAction(
- service->extensions()->at(size_before + 2), 0);
+ service->toolbar_model()->MoveBrowserAction(service->extensions()->at(2), 0);
EXPECT_EQ(kTooltipC, GetBrowserActionsBar().GetTooltip(0));
EXPECT_EQ(kTooltipA, GetBrowserActionsBar().GetTooltip(1));
@@ -363,8 +359,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, IncognitoDragging) {
EXPECT_EQ(kTooltipA, incognito_bar.GetTooltip(1));
// CAB -> CBA
- service->toolbar_model()->MoveBrowserAction(
- service->extensions()->at(size_before + 1), 1);
+ service->toolbar_model()->MoveBrowserAction(service->extensions()->at(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 b2d286a..dd353b0 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));
- ASSERT_EQ(size_before + 1, service->extensions()->size());
- Extension* extension = service->extensions()->at(size_before);
+ ExtensionsService* service = browser()->profile()->GetExtensionsService();
+ const ExtensionList* extensions = service->extensions();
+ ASSERT_EQ(1u, extensions->size());
+ Extension* extension = extensions->at(0);
EXPECT_STREQ(WideToUTF8(L"Hreggvi\u00F0ur: l10n browser action").c_str(),
extension->description().c_str());
@@ -317,9 +317,6 @@ 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));
@@ -329,8 +326,10 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, TitleLocalizationPageAction) {
ui_test_utils::NavigateToURL(browser(), url);
ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(1));
- ASSERT_EQ(size_before + 1, service->extensions()->size());
- Extension* extension = service->extensions()->at(size_before);
+ ExtensionsService* service = browser()->profile()->GetExtensionsService();
+ const ExtensionList* extensions = service->extensions();
+ ASSERT_EQ(1u, extensions->size());
+ Extension* extension = extensions->at(0);
EXPECT_STREQ(WideToUTF8(L"Hreggvi\u00F0ur: l10n page action").c_str(),
extension->description().c_str());
@@ -699,9 +698,8 @@ 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(size_before + 1, service->extensions()->size());
+ EXPECT_EQ(1u, 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(
@@ -713,9 +711,9 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, MAYBE_PluginLoadUnload) {
tab->render_view_host(), L"", L"testPluginWorks()", &result);
EXPECT_TRUE(result);
- EXPECT_EQ(size_before + 1, service->extensions()->size());
- UnloadExtension(service->extensions()->at(size_before)->id());
- EXPECT_EQ(size_before, service->extensions()->size());
+ EXPECT_EQ(1u, service->extensions()->size());
+ UnloadExtension(service->extensions()->at(0)->id());
+ EXPECT_EQ(0u, 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 32b67af..0bf5815 100644
--- a/chrome/browser/extensions/extension_crash_recovery_browsertest.cc
+++ b/chrome/browser/extensions/extension_crash_recovery_browsertest.cc
@@ -82,13 +82,12 @@ 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()->back();
+ Extension* extension = GetExtensionsService()->extensions()->at(0);
ASSERT_TRUE(extension);
first_extension_id_ = extension->id();
- CheckExtensionConsistency(size_before);
+ CheckExtensionConsistency(0);
}
void LoadSecondExtension() {
@@ -106,38 +105,35 @@ class ExtensionCrashRecoveryTest : public ExtensionBrowserTest {
};
IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest, Basic) {
- const size_t size_before = GetExtensionsService()->extensions()->size();
LoadTestExtension();
- CrashExtension(size_before);
- ASSERT_EQ(size_before, GetExtensionsService()->extensions()->size());
+ CrashExtension(0);
+ ASSERT_TRUE(GetExtensionsService()->extensions()->empty());
AcceptCrashedExtensionInfobar(0);
SCOPED_TRACE("after clicking the infobar");
- CheckExtensionConsistency(size_before);
+ CheckExtensionConsistency(0);
}
IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest, CloseAndReload) {
- const size_t size_before = GetExtensionsService()->extensions()->size();
LoadTestExtension();
- CrashExtension(size_before);
- ASSERT_EQ(size_before, GetExtensionsService()->extensions()->size());
+ CrashExtension(0);
+ ASSERT_TRUE(GetExtensionsService()->extensions()->empty());
CancelCrashedExtensionInfobar(0);
ReloadExtension(first_extension_id_);
SCOPED_TRACE("after reloading");
- CheckExtensionConsistency(size_before);
+ CheckExtensionConsistency(0);
}
IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest, ReloadIndependently) {
- const size_t size_before = GetExtensionsService()->extensions()->size();
LoadTestExtension();
- CrashExtension(size_before);
- ASSERT_EQ(size_before, GetExtensionsService()->extensions()->size());
+ CrashExtension(0);
+ ASSERT_TRUE(GetExtensionsService()->extensions()->empty());
ReloadExtension(first_extension_id_);
SCOPED_TRACE("after reloading");
- CheckExtensionConsistency(size_before);
+ CheckExtensionConsistency(0);
TabContents* current_tab = browser()->GetSelectedTabContents();
ASSERT_TRUE(current_tab);
@@ -151,82 +147,77 @@ 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(size_before);
- ASSERT_EQ(size_before, GetExtensionsService()->extensions()->size());
+ CrashExtension(0);
+ ASSERT_TRUE(GetExtensionsService()->extensions()->empty());
}
IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest, TwoExtensionsCrashFirst) {
- const size_t size_before = GetExtensionsService()->extensions()->size();
LoadTestExtension();
LoadSecondExtension();
- CrashExtension(size_before);
- ASSERT_EQ(size_before + 1, GetExtensionsService()->extensions()->size());
+ CrashExtension(0);
+ ASSERT_EQ(1U, GetExtensionsService()->extensions()->size());
AcceptCrashedExtensionInfobar(0);
SCOPED_TRACE("after clicking the infobar");
- CheckExtensionConsistency(size_before);
- CheckExtensionConsistency(size_before + 1);
+ CheckExtensionConsistency(0);
+ CheckExtensionConsistency(1);
}
IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest, TwoExtensionsCrashSecond) {
- const size_t size_before = GetExtensionsService()->extensions()->size();
LoadTestExtension();
LoadSecondExtension();
- CrashExtension(size_before + 1);
- ASSERT_EQ(size_before + 1, GetExtensionsService()->extensions()->size());
+ CrashExtension(1);
+ ASSERT_EQ(1U, GetExtensionsService()->extensions()->size());
AcceptCrashedExtensionInfobar(0);
SCOPED_TRACE("after clicking the infobar");
- CheckExtensionConsistency(size_before);
- CheckExtensionConsistency(size_before + 1);
+ CheckExtensionConsistency(0);
+ CheckExtensionConsistency(1);
}
IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest,
TwoExtensionsCrashBothAtOnce) {
- const size_t size_before = GetExtensionsService()->extensions()->size();
LoadTestExtension();
LoadSecondExtension();
- CrashExtension(size_before);
- ASSERT_EQ(size_before + 1, GetExtensionsService()->extensions()->size());
- CrashExtension(size_before);
- ASSERT_EQ(size_before, GetExtensionsService()->extensions()->size());
+ CrashExtension(0);
+ ASSERT_EQ(1U, GetExtensionsService()->extensions()->size());
+ CrashExtension(0);
+ ASSERT_TRUE(GetExtensionsService()->extensions()->empty());
{
SCOPED_TRACE("first infobar");
AcceptCrashedExtensionInfobar(0);
- CheckExtensionConsistency(size_before);
+ CheckExtensionConsistency(0);
}
{
SCOPED_TRACE("second infobar");
AcceptCrashedExtensionInfobar(0);
- CheckExtensionConsistency(size_before);
- CheckExtensionConsistency(size_before + 1);
+ CheckExtensionConsistency(0);
+ CheckExtensionConsistency(1);
}
}
IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest, TwoExtensionsOneByOne) {
- const size_t size_before = GetExtensionsService()->extensions()->size();
LoadTestExtension();
- CrashExtension(size_before);
- ASSERT_EQ(size_before, GetExtensionsService()->extensions()->size());
+ CrashExtension(0);
+ ASSERT_TRUE(GetExtensionsService()->extensions()->empty());
LoadSecondExtension();
- CrashExtension(size_before);
- ASSERT_EQ(size_before, GetExtensionsService()->extensions()->size());
+ CrashExtension(0);
+ ASSERT_TRUE(GetExtensionsService()->extensions()->empty());
{
SCOPED_TRACE("first infobar");
AcceptCrashedExtensionInfobar(0);
- CheckExtensionConsistency(size_before);
+ CheckExtensionConsistency(0);
}
{
SCOPED_TRACE("second infobar");
AcceptCrashedExtensionInfobar(0);
- CheckExtensionConsistency(size_before);
- CheckExtensionConsistency(size_before + 1);
+ CheckExtensionConsistency(0);
+ CheckExtensionConsistency(1);
}
}
@@ -235,42 +226,39 @@ 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(size_before);
- ASSERT_EQ(size_before, GetExtensionsService()->extensions()->size());
+ CrashExtension(0);
+ ASSERT_TRUE(GetExtensionsService()->extensions()->empty());
LoadSecondExtension();
- CrashExtension(size_before);
- ASSERT_EQ(size_before, GetExtensionsService()->extensions()->size());
+ CrashExtension(0);
+ ASSERT_TRUE(GetExtensionsService()->extensions()->empty());
}
IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest,
TwoExtensionsIgnoreFirst) {
- const size_t size_before = GetExtensionsService()->extensions()->size();
LoadTestExtension();
LoadSecondExtension();
- CrashExtension(size_before);
- ASSERT_EQ(size_before + 1, GetExtensionsService()->extensions()->size());
- CrashExtension(size_before);
- ASSERT_EQ(size_before, GetExtensionsService()->extensions()->size());
+ CrashExtension(0);
+ ASSERT_EQ(1U, GetExtensionsService()->extensions()->size());
+ CrashExtension(0);
+ ASSERT_TRUE(GetExtensionsService()->extensions()->empty());
CancelCrashedExtensionInfobar(0);
AcceptCrashedExtensionInfobar(1);
SCOPED_TRACE("infobars done");
- ASSERT_EQ(size_before + 1, GetExtensionsService()->extensions()->size());
- CheckExtensionConsistency(size_before);
+ ASSERT_EQ(1U, GetExtensionsService()->extensions()->size());
+ CheckExtensionConsistency(0);
}
IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest,
TwoExtensionsReloadIndependently) {
- const size_t size_before = GetExtensionsService()->extensions()->size();
LoadTestExtension();
LoadSecondExtension();
- CrashExtension(size_before);
- ASSERT_EQ(size_before + 1, GetExtensionsService()->extensions()->size());
- CrashExtension(size_before);
- ASSERT_EQ(size_before, GetExtensionsService()->extensions()->size());
+ CrashExtension(0);
+ ASSERT_EQ(1U, GetExtensionsService()->extensions()->size());
+ CrashExtension(0);
+ ASSERT_TRUE(GetExtensionsService()->extensions()->empty());
{
SCOPED_TRACE("first: reload");
@@ -281,13 +269,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(size_before);
+ CheckExtensionConsistency(0);
}
{
SCOPED_TRACE("second: infobar");
AcceptCrashedExtensionInfobar(0);
- CheckExtensionConsistency(size_before);
- CheckExtensionConsistency(size_before + 1);
+ CheckExtensionConsistency(0);
+ CheckExtensionConsistency(1);
}
}
diff --git a/chrome/browser/extensions/extension_dom_ui.cc b/chrome/browser/extensions/extension_dom_ui.cc
index c3663a0..e9866b1 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::kDisableTabbedBookmarkManager)) {
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableTabbedBookmarkManager)) {
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 5162ebe..014677a 100644
--- a/chrome/browser/extensions/extension_management_tests.cc
+++ b/chrome/browser/extensions/extension_management_tests.cc
@@ -49,7 +49,8 @@ class ExtensionManagementTest : public ExtensionBrowserTest {
// the operation was completed successfully.
bool InstallAndUpdateIncreasingPermissionsExtension() {
ExtensionsService* service = browser()->profile()->GetExtensionsService();
- size_t size_before = service->extensions()->size();
+ if (service->HasInstalledExtensions())
+ return false;
// Install the initial version, which should happen just fine.
if (!InstallExtension(
@@ -58,13 +59,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() != size_before + 1)
+ if (service->extensions()->size() != 1u)
return false;
if (!UpdateExtension(
- service->extensions()->at(size_before)->id(),
+ service->extensions()->at(0)->id(),
test_data_dir_.AppendASCII("permissions-high-v2.crx"), -1))
return false;
- EXPECT_EQ(size_before, service->extensions()->size());
+ EXPECT_EQ(0u, service->extensions()->size());
if (service->disabled_extensions()->size() != 1u)
return false;
return true;
@@ -74,7 +75,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();
- const size_t size_before = service->extensions()->size();
+ ASSERT_FALSE(service->HasInstalledExtensions());
ASSERT_TRUE(InstallExtension(
test_data_dir_.AppendASCII("install/install.crx"), 1));
@@ -82,32 +83,28 @@ 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(size_before),
- "1.0"));
+ EXPECT_TRUE(IsExtensionAtVersion(service->extensions()->at(0), "1.0"));
}
IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, InstallOlderVersion) {
ExtensionsService* service = browser()->profile()->GetExtensionsService();
- const size_t size_before = service->extensions()->size();
+ ASSERT_FALSE(service->HasInstalledExtensions());
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(size_before),
- "1.0"));
+ EXPECT_TRUE(IsExtensionAtVersion(service->extensions()->at(0), "1.0"));
}
IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, InstallThenCancel) {
ExtensionsService* service = browser()->profile()->GetExtensionsService();
- const size_t size_before = service->extensions()->size();
+ ASSERT_FALSE(service->HasInstalledExtensions());
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(size_before),
- "1.0"));
+ EXPECT_TRUE(IsExtensionAtVersion(service->extensions()->at(0), "1.0"));
}
// Tests that installing and uninstalling extensions don't crash with an
@@ -133,11 +130,10 @@ 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(size_before + 1, service->extensions()->size());
+ EXPECT_EQ(1u, service->extensions()->size());
EXPECT_EQ(0u, service->disabled_extensions()->size());
}
@@ -145,12 +141,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(size_before, service->extensions()->size());
+ EXPECT_EQ(0u, service->extensions()->size());
EXPECT_EQ(0u, service->disabled_extensions()->size());
+ ASSERT_FALSE(service->HasInstalledExtensions());
}
// Tests that disabling and re-enabling an extension works.
@@ -158,29 +154,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(size_before + 1, service->extensions()->size());
+ ASSERT_EQ(1u, service->extensions()->size());
EXPECT_EQ(0u, service->disabled_extensions()->size());
- Extension* extension = service->extensions()->at(size_before);
+ Extension* extension = service->extensions()->at(0);
EXPECT_TRUE(manager->GetBackgroundHostForExtension(extension));
ASSERT_TRUE(service->HasInstalledExtensions());
// After disabling, the background page should go away.
service->DisableExtension("bjafgdebaacbbbecmhlhpofkepfkgcpa");
- EXPECT_EQ(size_before, service->extensions()->size());
+ EXPECT_EQ(0u, 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(size_before + 1, service->extensions()->size());
+ EXPECT_EQ(1u, service->extensions()->size());
EXPECT_EQ(0u, service->disabled_extensions()->size());
EXPECT_TRUE(manager->GetBackgroundHostForExtension(extension));
ASSERT_TRUE(service->HasInstalledExtensions());
@@ -203,15 +199,13 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, AutoUpdate) {
// Install version 1 of the extension.
ExtensionsService* service = browser()->profile()->GetExtensionsService();
- const size_t size_before = service->extensions()->size();
- ASSERT_TRUE(service->disabled_extensions()->empty());
+ ASSERT_FALSE(service->HasInstalledExtensions());
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("ogjcoiohnmldgjemafoockdghcjciccf",
- extensions->at(size_before)->id());
- ASSERT_EQ("1.0", extensions->at(size_before)->VersionString());
+ ASSERT_EQ(1u, extensions->size());
+ ASSERT_EQ("ogjcoiohnmldgjemafoockdghcjciccf", extensions->at(0)->id());
+ ASSERT_EQ("1.0", extensions->at(0)->VersionString());
// We don't want autoupdate blacklist checks.
service->updater()->set_blacklist_checks_enabled(false);
@@ -220,10 +214,9 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, AutoUpdate) {
service->updater()->CheckNow();
ASSERT_TRUE(WaitForExtensionInstall());
extensions = service->extensions();
- ASSERT_EQ(size_before + 1, extensions->size());
- ASSERT_EQ("ogjcoiohnmldgjemafoockdghcjciccf",
- extensions->at(size_before)->id());
- ASSERT_EQ("2.0", extensions->at(size_before)->VersionString());
+ ASSERT_EQ(1u, extensions->size());
+ ASSERT_EQ("ogjcoiohnmldgjemafoockdghcjciccf", extensions->at(0)->id());
+ ASSERT_EQ("2.0", extensions->at(0)->VersionString());
// Now try doing an update to version 3, which has been incorrectly
// signed. This should fail.
@@ -237,9 +230,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, AutoUpdate) {
// Make sure the extension state is the same as before.
extensions = service->extensions();
- ASSERT_EQ(size_before + 1, extensions->size());
- ASSERT_EQ("ogjcoiohnmldgjemafoockdghcjciccf",
- extensions->at(size_before)->id());
- ASSERT_EQ("2.0", extensions->at(size_before)->VersionString());
+ ASSERT_EQ(1u, extensions->size());
+ ASSERT_EQ("ogjcoiohnmldgjemafoockdghcjciccf", extensions->at(0)->id());
+ ASSERT_EQ("2.0", extensions->at(0)->VersionString());
}
#endif // !defined(OS_LINUX)
diff --git a/chrome/browser/extensions/extension_startup_unittest.cc b/chrome/browser/extensions/extension_startup_unittest.cc
index 4dc6efd..6894b87 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(4, true); // 1 component extension and 3 others.
+ WaitForServicesToStart(3, true);
TestInjection(true, true);
}
diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc
index 802ad29..2414602 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::kDisableTabbedBookmarkManager)) {
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableTabbedBookmarkManager)) {
FilePath bookmark_manager_path;
if (PathService::Get(chrome::DIR_BOOKMARK_MANAGER,
&bookmark_manager_path)) {