summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/chromeos/notifications/notification_browsertest.cc24
-rw-r--r--chrome/browser/chromeos/notifications/notification_panel.cc25
2 files changed, 22 insertions, 27 deletions
diff --git a/chrome/browser/chromeos/notifications/notification_browsertest.cc b/chrome/browser/chromeos/notifications/notification_browsertest.cc
index 10cac18..d63e081 100644
--- a/chrome/browser/chromeos/notifications/notification_browsertest.cc
+++ b/chrome/browser/chromeos/notifications/notification_browsertest.cc
@@ -93,6 +93,15 @@ class NotificationTest : public InProcessBrowserTest,
}
}
+ // Busy loop to wait until the view becomes visible in the panel.
+ void WaitForVisible(BalloonViewImpl* view) {
+ WaitForResize(view);
+ NotificationPanelTester* tester = GetNotificationPanel()->GetTester();
+ while (!tester->IsVisible(view)) {
+ ui_test_utils::RunAllPendingInMessageLoop();
+ }
+ }
+
// Busy loop to wait until the webkit give some size to the notification.
void WaitForResize(BalloonViewImpl* view) {
while (view->bounds().IsEmpty()) {
@@ -404,8 +413,7 @@ IN_PROC_BROWSER_TEST_F(NotificationTest, TestCloseOpen) {
EXPECT_EQ(NotificationPanel::CLOSED, tester->state());
}
-// TODO(oshima): bug chromium-os:7139 Fix this flaky test on ChromeOS.
-IN_PROC_BROWSER_TEST_F(NotificationTest, FLAKY_TestScrollBalloonToVisible) {
+IN_PROC_BROWSER_TEST_F(NotificationTest, TestScrollBalloonToVisible) {
BalloonCollectionImpl* collection = GetBalloonCollectionImpl();
NotificationPanel* panel = GetNotificationPanel();
NotificationPanelTester* tester = panel->GetTester();
@@ -417,27 +425,25 @@ IN_PROC_BROWSER_TEST_F(NotificationTest, FLAKY_TestScrollBalloonToVisible) {
// new notification is always visible
for (int i = 0; i < create_count; i++) {
{
- SCOPED_TRACE(base::StringPrintf("new n%d", i));
+ SCOPED_TRACE(base::StringPrintf("new normal %d", i));
std::string id = base::StringPrintf("n%d", i);
collection->Add(NewMockNotification(id), profile);
EXPECT_EQ(NotificationPanel::STICKY_AND_NEW, tester->state());
BalloonViewImpl* view =
tester->GetBalloonView(collection, NewMockNotification(id));
- WaitForResize(view);
- EXPECT_TRUE(tester->IsVisible(view));
+ WaitForVisible(view);
}
{
- SCOPED_TRACE(base::StringPrintf("new s%d", i));
+ SCOPED_TRACE(base::StringPrintf("new system %d", i));
std::string id = base::StringPrintf("s%d", i);
collection->AddSystemNotification(
NewMockNotification(id), browser()->profile(), true, false);
- ui_test_utils::RunAllPendingInMessageLoop();
BalloonViewImpl* view =
tester->GetBalloonView(collection, NewMockNotification(id));
- WaitForResize(view);
- EXPECT_TRUE(tester->IsVisible(view));
+ WaitForVisible(view);
}
}
+
// Update should not change the visibility
for (int i = 0; i < create_count; i++) {
{
diff --git a/chrome/browser/chromeos/notifications/notification_panel.cc b/chrome/browser/chromeos/notifications/notification_panel.cc
index 606ebf6..1d3d857 100644
--- a/chrome/browser/chromeos/notifications/notification_panel.cc
+++ b/chrome/browser/chromeos/notifications/notification_panel.cc
@@ -66,23 +66,6 @@ chromeos::BalloonViewImpl* GetBalloonViewOf(const Balloon* balloon) {
return static_cast<chromeos::BalloonViewImpl*>(balloon->view());
}
-// A WidgetGtk to preevnt recursive calls to PaintNow, which is observed
-// with gtk 2.18.6. See http://crbug.com/42235 for more details.
-class PanelWidget : public views::WidgetGtk {
- public:
- PanelWidget() : WidgetGtk(TYPE_WINDOW) {
- }
-
- virtual ~PanelWidget() {
- // Enable double buffering because the panel has both pure views control and
- // native controls (scroll bar).
- EnableDoubleBuffer(true);
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(PanelWidget);
-};
-
// A WidgetGtk that covers entire ScrollView's viewport. Without this,
// all renderer's native gtk widgets are moved one by one via
// View::VisibleBoundsInRootChanged() notification, which makes
@@ -434,7 +417,13 @@ void NotificationPanel::Show() {
if (!panel_widget_) {
// TODO(oshima): Using window because Popup widget behaves weird
// when resizing. This needs to be investigated.
- panel_widget_ = new PanelWidget();
+ views::WidgetGtk* widget_gtk =
+ new views::WidgetGtk(views::WidgetGtk::TYPE_WINDOW);
+ // Enable double buffering because the panel has both pure views
+ // control and native controls (scroll bar).
+ widget_gtk->EnableDoubleBuffer(true);
+ panel_widget_ = widget_gtk;
+
gfx::Rect bounds = GetPreferredBounds();
bounds = bounds.Union(min_bounds_);
panel_widget_->Init(NULL, bounds);