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

Side by Side Diff: chrome/browser/notifications/desktop_notifications_unittest.cc

Issue 10831155: notifications: Refactor MockBalloonView into FakeBalloonView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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/notifications/fake_balloon_view.h » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/notifications/desktop_notifications_unittest.h" 5 #include "chrome/browser/notifications/desktop_notifications_unittest.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/notifications/fake_balloon_view.h"
9 #include "chrome/browser/prefs/browser_prefs.h" 10 #include "chrome/browser/prefs/browser_prefs.h"
10 #include "chrome/common/pref_names.h" 11 #include "chrome/common/pref_names.h"
11 #include "chrome/test/base/testing_pref_service.h" 12 #include "chrome/test/base/testing_pref_service.h"
12 #include "content/public/common/show_desktop_notification_params.h" 13 #include "content/public/common/show_desktop_notification_params.h"
13 14
14 #if defined(USE_AURA) 15 #if defined(USE_AURA)
15 #include "ash/shell.h" 16 #include "ash/shell.h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"
17 #include "ui/aura/env.h" 18 #include "ui/aura/env.h"
18 #include "ui/aura/root_window.h" 19 #include "ui/aura/root_window.h"
(...skipping 26 matching lines...) Expand all
45 } 46 }
46 47
47 bool MockBalloonCollection::HasSpace() const { 48 bool MockBalloonCollection::HasSpace() const {
48 return count() < kMockBalloonSpace; 49 return count() < kMockBalloonSpace;
49 } 50 }
50 51
51 Balloon* MockBalloonCollection::MakeBalloon(const Notification& notification, 52 Balloon* MockBalloonCollection::MakeBalloon(const Notification& notification,
52 Profile* profile) { 53 Profile* profile) {
53 // Start with a normal balloon but mock out the view. 54 // Start with a normal balloon but mock out the view.
54 Balloon* balloon = BalloonCollectionImpl::MakeBalloon(notification, profile); 55 Balloon* balloon = BalloonCollectionImpl::MakeBalloon(notification, profile);
55 balloon->set_view(new MockBalloonView(balloon)); 56 balloon->set_view(new FakeBalloonView(balloon));
56 balloons_.push_back(balloon); 57 balloons_.push_back(balloon);
57 return balloon; 58 return balloon;
58 } 59 }
59 60
60 void MockBalloonCollection::OnBalloonClosed(Balloon* source) { 61 void MockBalloonCollection::OnBalloonClosed(Balloon* source) {
61 std::deque<Balloon*>::iterator it; 62 std::deque<Balloon*>::iterator it;
62 for (it = balloons_.begin(); it != balloons_.end(); ++it) { 63 for (it = balloons_.begin(); it != balloons_.end(); ++it) {
63 if (*it == source) { 64 if (*it == source) {
64 balloons_.erase(it); 65 balloons_.erase(it);
65 BalloonCollectionImpl::OnBalloonClosed(source); 66 BalloonCollectionImpl::OnBalloonClosed(source);
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 } 466 }
466 467
467 // Now change the position to upper left. Confirm that the X value for the 468 // Now change the position to upper left. Confirm that the X value for the
468 // balloons gets smaller. 469 // balloons gets smaller.
469 local_state_.SetInteger(prefs::kDesktopNotificationPosition, 470 local_state_.SetInteger(prefs::kDesktopNotificationPosition,
470 BalloonCollection::UPPER_LEFT); 471 BalloonCollection::UPPER_LEFT);
471 472
472 int current_x = (*balloons.begin())->GetPosition().x(); 473 int current_x = (*balloons.begin())->GetPosition().x();
473 EXPECT_LT(current_x, last_x); 474 EXPECT_LT(current_x, last_x);
474 } 475 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/notifications/fake_balloon_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698