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

Side by Side Diff: chrome/browser/chromeos/notifications/notification_browsertest.cc

Issue 7747044: [chromeos] Do not move notifications to KEEP_SIZE state when mouse moved. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/chromeos/notifications/notification_panel.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/memory/ref_counted.h" 5 #include "base/memory/ref_counted.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/string16.h" 8 #include "base/string16.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 ui_test_utils::RunAllPendingInMessageLoop(); 167 ui_test_utils::RunAllPendingInMessageLoop();
168 EXPECT_EQ(0, tester->GetNewNotificationCount()); 168 EXPECT_EQ(0, tester->GetNewNotificationCount());
169 EXPECT_EQ(0, tester->GetNotificationCount()); 169 EXPECT_EQ(0, tester->GetNotificationCount());
170 EXPECT_EQ(NotificationPanel::CLOSED, tester->state()); 170 EXPECT_EQ(NotificationPanel::CLOSED, tester->state());
171 171
172 // CLOSE is asynchronous. Run the all pending tasks to finish closing 172 // CLOSE is asynchronous. Run the all pending tasks to finish closing
173 // task. 173 // task.
174 ui_test_utils::RunAllPendingInMessageLoop(); 174 ui_test_utils::RunAllPendingInMessageLoop();
175 } 175 }
176 176
177 // [CLOSED] -add->[STICKY_AND_NEW] -mouse-> [KEEP_SIZE] -remove/add-> 177 // [CLOSED] -add->[STICKY_AND_NEW] -mouse-> [STICKY_AND_NEW] -remove/add->
178 // [KEEP_SIZE] -remove-> [CLOSED] -add-> [STICKY_AND_NEW] -remove-> [CLOSED] 178 // [STICKY_AND_NEW] -remove-> [CLOSED] -add-> [STICKY_AND_NEW] -remove->
179 // [CLOSED]
179 IN_PROC_BROWSER_TEST_F(NotificationTest, TestKeepSizeState) { 180 IN_PROC_BROWSER_TEST_F(NotificationTest, TestKeepSizeState) {
180 BalloonCollectionImpl* collection = GetBalloonCollectionImpl(); 181 BalloonCollectionImpl* collection = GetBalloonCollectionImpl();
181 NotificationPanel* panel = GetNotificationPanel(); 182 NotificationPanel* panel = GetNotificationPanel();
182 NotificationPanelTester* tester = panel->GetTester(); 183 NotificationPanelTester* tester = panel->GetTester();
183 184
184 EXPECT_EQ(NotificationPanel::CLOSED, tester->state()); 185 EXPECT_EQ(NotificationPanel::CLOSED, tester->state());
185 186
186 // Using system notification as regular notification. 187 // Using system notification as regular notification.
187 collection->Add(NewMockNotification("1"), browser()->profile()); 188 collection->Add(NewMockNotification("1"), browser()->profile());
188 collection->Add(NewMockNotification("2"), browser()->profile()); 189 collection->Add(NewMockNotification("2"), browser()->profile());
189 190
190 EXPECT_EQ(NotificationPanel::STICKY_AND_NEW, tester->state()); 191 EXPECT_EQ(NotificationPanel::STICKY_AND_NEW, tester->state());
191 192
192 panel->OnMouseMotion(gfx::Point(10, 10)); 193 panel->OnMouseMotion(gfx::Point(10, 10));
193 EXPECT_EQ(NotificationPanel::KEEP_SIZE, tester->state()); 194 EXPECT_EQ(NotificationPanel::STICKY_AND_NEW, tester->state());
194 195
195 collection->RemoveById("1"); 196 collection->RemoveById("1");
196 ui_test_utils::RunAllPendingInMessageLoop(); 197 ui_test_utils::RunAllPendingInMessageLoop();
197 EXPECT_EQ(1, tester->GetNewNotificationCount()); 198 EXPECT_EQ(1, tester->GetNewNotificationCount());
198 EXPECT_EQ(1, tester->GetNotificationCount()); 199 EXPECT_EQ(1, tester->GetNotificationCount());
199 EXPECT_EQ(NotificationPanel::KEEP_SIZE, tester->state()); 200 EXPECT_EQ(NotificationPanel::STICKY_AND_NEW, tester->state());
200 201
201 collection->Add(NewMockNotification("1"), browser()->profile()); 202 collection->Add(NewMockNotification("1"), browser()->profile());
202 ui_test_utils::RunAllPendingInMessageLoop(); 203 ui_test_utils::RunAllPendingInMessageLoop();
203 EXPECT_EQ(2, tester->GetNewNotificationCount()); 204 EXPECT_EQ(2, tester->GetNewNotificationCount());
204 EXPECT_EQ(2, tester->GetNotificationCount()); 205 EXPECT_EQ(2, tester->GetNotificationCount());
205 EXPECT_EQ(NotificationPanel::KEEP_SIZE, tester->state()); 206 EXPECT_EQ(NotificationPanel::STICKY_AND_NEW, tester->state());
206 207
207 collection->RemoveById("1"); 208 collection->RemoveById("1");
208 ui_test_utils::RunAllPendingInMessageLoop(); 209 ui_test_utils::RunAllPendingInMessageLoop();
209 EXPECT_EQ(1, tester->GetNewNotificationCount()); 210 EXPECT_EQ(1, tester->GetNewNotificationCount());
210 EXPECT_EQ(1, tester->GetNotificationCount()); 211 EXPECT_EQ(1, tester->GetNotificationCount());
211 EXPECT_EQ(NotificationPanel::KEEP_SIZE, tester->state()); 212 EXPECT_EQ(NotificationPanel::STICKY_AND_NEW, tester->state());
212 213
213 collection->RemoveById("2"); 214 collection->RemoveById("2");
214 ui_test_utils::RunAllPendingInMessageLoop(); 215 ui_test_utils::RunAllPendingInMessageLoop();
215 EXPECT_EQ(0, tester->GetNotificationCount()); 216 EXPECT_EQ(0, tester->GetNotificationCount());
216 EXPECT_EQ(NotificationPanel::CLOSED, tester->state()); 217 EXPECT_EQ(NotificationPanel::CLOSED, tester->state());
217 218
218 collection->Add(NewMockNotification("3"), browser()->profile()); 219 collection->Add(NewMockNotification("3"), browser()->profile());
219 EXPECT_EQ(NotificationPanel::STICKY_AND_NEW, tester->state()); 220 EXPECT_EQ(NotificationPanel::STICKY_AND_NEW, tester->state());
220 collection->RemoveById("3"); 221 collection->RemoveById("3");
221 222
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 EXPECT_TRUE(collection->AddWebUIMessageCallback( 596 EXPECT_TRUE(collection->AddWebUIMessageCallback(
596 NewMockNotification("1"), 597 NewMockNotification("1"),
597 "test", 598 "test",
598 NewCallback( 599 NewCallback(
599 static_cast<NotificationTest*>(this), 600 static_cast<NotificationTest*>(this),
600 &NotificationTest::HandleWebUIMessage))); 601 &NotificationTest::HandleWebUIMessage)));
601 MessageLoop::current()->Run(); 602 MessageLoop::current()->Run();
602 } 603 }
603 604
604 } // namespace chromeos 605 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/notifications/notification_panel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698