Commit e84f2be8 authored by finnur@chromium.org's avatar finnur@chromium.org

Revert 274606 "Temporarily re-enabling SizeAfterPrefChange test ..."

> Temporarily re-enabling SizeAfterPrefChange test with traces.
> 
> BUG=379170
> TBR=asargent
> 
> Review URL: https://codereview.chromium.org/318483002

TBR=finnur@chromium.org

Review URL: https://codereview.chromium.org/314803002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274623 0039d316-1c4b-4281-b951-d872f2087c98
parent e0b83a16
......@@ -158,10 +158,10 @@ ExtensionToolbarModel::Action ExtensionToolbarModel::ExecuteBrowserAction(
}
void ExtensionToolbarModel::SetVisibleIconCount(int count) {
VLOG(4) << "visible_icon_count_ before: " << visible_icon_count_;
LOG(ERROR) << "visible_icon_count_ before: " << visible_icon_count_;
visible_icon_count_ =
count == static_cast<int>(toolbar_items_.size()) ? -1 : count;
VLOG(4) << "SetVisibleIconCount "
LOG(ERROR) << "SetVisibleIconCount "
<< count << " == " << toolbar_items_.size() << " -> "
<< visible_icon_count_ << " "
<< "is_highlighting: " << is_highlighting_;
......@@ -176,23 +176,23 @@ void ExtensionToolbarModel::SetVisibleIconCount(int count) {
void ExtensionToolbarModel::OnExtensionLoaded(
content::BrowserContext* browser_context,
const Extension* extension) {
VLOG(4) << "Loading extension";
LOG(ERROR) << "Loading extension";
// We don't want to add the same extension twice. It may have already been
// added by EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED below, if the user
// hides the browser action and then disables and enables the extension.
for (size_t i = 0; i < toolbar_items_.size(); i++) {
if (toolbar_items_[i].get() == extension) {
VLOG(4) << "... but returning early";
LOG(ERROR) << "... but returning early";
return;
}
}
if (ExtensionActionAPI::GetBrowserActionVisibility(extension_prefs_,
extension->id())) {
VLOG(4) << "Adding extensions";
LOG(ERROR) << "Adding extensions";
AddExtension(extension);
} else {
VLOG(4) << "NOT visible";
LOG(ERROR) << "NOT visible";
}
}
......@@ -230,16 +230,15 @@ void ExtensionToolbarModel::Observe(
ExtensionRegistry::EVERYTHING);
if (ExtensionActionAPI::GetBrowserActionVisibility(extension_prefs_,
extension->id())) {
VLOG(4) << "Adding extension";
LOG(ERROR) << "Adding extension";
AddExtension(extension);
} else {
VLOG(4) << "Removing extension";
LOG(ERROR) << "Removing extension";
RemoveExtension(extension);
}
}
void ExtensionToolbarModel::OnReady() {
VLOG(4) << "OnReady called";
ExtensionRegistry* registry = ExtensionRegistry::Get(profile_);
InitializeExtensionList(registry->enabled_extensions());
// Wait until the extension system is ready before observing any further
......@@ -353,7 +352,6 @@ void ExtensionToolbarModel::InitializeExtensionList(
last_known_positions_ = extension_prefs_->GetToolbarOrder();
Populate(last_known_positions_, extensions);
VLOG(4) << "extensions_initialized!";
extensions_initialized_ = true;
FOR_EACH_OBSERVER(Observer, observers_, VisibleCountChanged());
}
......
......@@ -27,12 +27,6 @@ class ExtensionToolbarModelTest : public ExtensionBrowserTest,
ExtensionBrowserTest::SetUp();
}
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
ExtensionBrowserTest::SetUpCommandLine(command_line);
command_line->AppendSwitchNative(
"vmodule", "*extension_toolbar_model*=4,*browser_actions_container*=4");
}
virtual void SetUpOnMainThread() OVERRIDE {
model_ = ExtensionToolbarModel::Get(browser()->profile());
model_->AddObserver(this);
......@@ -590,32 +584,36 @@ IN_PROC_BROWSER_TEST_F(ExtensionToolbarModelTest, HighlightModeAdd) {
EXPECT_EQ(id_c, ExtensionAt(2)->id());
}
// Test is flaky (see crbug.com/379170), but currently enabled to gather traces.
// If it fails, ping Finnur.
IN_PROC_BROWSER_TEST_F(ExtensionToolbarModelTest, SizeAfterPrefChange) {
// Test is flaky on Linus and ChromeOS, see crbug.com/379170.
#if defined(OS_LINUX) || defined(OS_CHROMEOS)
#define MAYBE_SizeAfterPrefChange DISABLED_SizeAfterPrefChange
#else
#define MAYBE_SizeAfterPrefChange SizeAfterPrefChange
#endif
IN_PROC_BROWSER_TEST_F(ExtensionToolbarModelTest, MAYBE_SizeAfterPrefChange) {
// Load two extensions with browser action.
base::FilePath extension_a_path(test_data_dir_.AppendASCII("api_test")
.AppendASCII("browser_action")
.AppendASCII("basics"));
VLOG(4) << "Loading [basics]";
LOG(ERROR) << "Loading [basics]";
ASSERT_TRUE(LoadExtension(extension_a_path));
base::FilePath extension_b_path(test_data_dir_.AppendASCII("api_test")
.AppendASCII("browser_action")
.AppendASCII("popup"));
VLOG(4) << "Loading [popup]";
LOG(ERROR) << "Loading [popup]";
ASSERT_TRUE(LoadExtension(extension_b_path));
std::string id_a = ExtensionAt(0)->id();
std::string id_b = ExtensionAt(1)->id();
VLOG(4) << "GetVisibleIconCount";
LOG(ERROR) << "GetVisibleIconCount";
// Should be at max size (-1).
EXPECT_EQ(-1, model_->GetVisibleIconCount());
VLOG(4) << "OnExtensionToolbarPrefChange";
LOG(ERROR) << "OnExtensionToolbarPrefChange";
model_->OnExtensionToolbarPrefChange();
VLOG(4) << "GetVisibleIconCount";
LOG(ERROR) << "GetVisibleIconCount";
// Should still be at max size.
EXPECT_EQ(-1, model_->GetVisibleIconCount());
......
......@@ -184,8 +184,6 @@ size_t BrowserActionsContainer::VisibleBrowserActions() const {
if (browser_action_views_[i]->visible())
++visible_actions;
}
VLOG(4) << "BAC::VisibleBrowserActions() returns " << visible_actions
<< " with size=" << browser_action_views_.size();
return visible_actions;
}
......@@ -674,13 +672,10 @@ void BrowserActionsContainer::BrowserActionAdded(const Extension* extension,
#endif
CloseOverflowMenu();
if (!ShouldDisplayBrowserAction(extension)) {
VLOG(4) << "Should not display: " << extension->name().c_str();
if (!ShouldDisplayBrowserAction(extension))
return;
}
size_t visible_actions = VisibleBrowserActions();
VLOG(4) << "Got back " << visible_actions << " visible.";
// Add the new browser action to the vector and the view hierarchy.
if (profile_->IsOffTheRecord())
......@@ -690,21 +685,17 @@ void BrowserActionsContainer::BrowserActionAdded(const Extension* extension,
AddChildViewAt(view, index);
// If we are still initializing the container, don't bother animating.
if (!model_->extensions_initialized()) {
VLOG(4) << "Still initializing";
if (!model_->extensions_initialized())
return;
}
// Enlarge the container if it was already at maximum size and we're not in
// the middle of upgrading.
if ((model_->GetVisibleIconCount() < 0) &&
!extensions::ExtensionSystem::Get(profile_)->runtime_data()->
IsBeingUpgraded(extension)) {
VLOG(4) << "At max, Save and animate";
suppress_chevron_ = true;
SaveDesiredSizeAndAnimate(gfx::Tween::LINEAR, visible_actions + 1);
} else {
VLOG(4) << "Not at max";
// Just redraw the (possibly modified) visible icon set.
OnBrowserActionVisibilityChanged();
}
......@@ -880,12 +871,9 @@ void BrowserActionsContainer::SaveDesiredSizeAndAnimate(
// NOTE: Don't save the icon count in incognito because there may be fewer
// icons in that mode. The result is that the container in a normal window is
// always at least as wide as in an incognito window.
if (!profile_->IsOffTheRecord()) {
if (!profile_->IsOffTheRecord())
model_->SetVisibleIconCount(num_visible_icons);
VLOG(4) << "Setting visible count: " << num_visible_icons;
} else {
VLOG(4) << "|Skipping| setting visible count: " << num_visible_icons;
}
int target_size = IconCountToWidth(num_visible_icons,
num_visible_icons < browser_action_views_.size());
if (!disable_animations_during_testing_) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment