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

Side by Side Diff: chrome/browser/ui/zoom/zoom_controller_unittest.cc

Issue 508263002: Simplify ZoomController by removing DefaultZoomLevel prefs machinery. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 6 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
« no previous file with comments | « chrome/browser/ui/zoom/zoom_controller_browsertest.cc ('k') | no next file » | 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 "base/message_loop/message_loop.h" 5 #include "base/message_loop/message_loop.h"
6 #include "base/prefs/pref_service.h" 6 #include "base/prefs/pref_service.h"
7 #include "chrome/browser/ui/browser.h" 7 #include "chrome/browser/ui/browser.h"
8 #include "chrome/browser/ui/browser_finder.h" 8 #include "chrome/browser/ui/browser_finder.h"
9 #include "chrome/browser/ui/zoom/zoom_controller.h" 9 #include "chrome/browser/ui/zoom/zoom_controller.h"
10 #include "chrome/browser/ui/zoom/zoom_observer.h" 10 #include "chrome/browser/ui/zoom/zoom_observer.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 web_contents(), 58 web_contents(),
59 zoom_level, 59 zoom_level,
60 zoom_level, 60 zoom_level,
61 ZoomController::ZOOM_MODE_DEFAULT, 61 ZoomController::ZOOM_MODE_DEFAULT,
62 false); 62 false);
63 EXPECT_CALL(zoom_observer_, OnZoomChanged(zoom_change_data)).Times(1); 63 EXPECT_CALL(zoom_observer_, OnZoomChanged(zoom_change_data)).Times(1);
64 zoom_controller_->DidNavigateMainFrame(content::LoadCommittedDetails(), 64 zoom_controller_->DidNavigateMainFrame(content::LoadCommittedDetails(),
65 content::FrameNavigateParams()); 65 content::FrameNavigateParams());
66 } 66 }
67 67
68 TEST_F(ZoomControllerTest, OnPreferenceChanged) {
69 double zoom_level = zoom_controller_->GetZoomLevel();
70 // Note that while the change in the default zoom level triggers an event,
71 // the current zoom level for this web contents does not change since the
72 // default zoom level in HostZoomMap is not updated.
73 // TODO(wjmaclean) Make sure changes to the default zoom level in preferences
74 // propagate to HostZoomMap. http://crbug.com/391484
75 ZoomController::ZoomChangedEventData zoom_change_data(
76 web_contents(),
77 zoom_level,
78 zoom_level,
79 ZoomController::ZOOM_MODE_DEFAULT,
80 false);
81 EXPECT_CALL(zoom_observer_, OnZoomChanged(zoom_change_data)).Times(1);
82 profile()->GetPrefs()->SetDouble(prefs::kDefaultZoomLevel, 110.0);
83 }
84
85 TEST_F(ZoomControllerTest, Observe) { 68 TEST_F(ZoomControllerTest, Observe) {
86 double new_zoom_level = 110.0; 69 double new_zoom_level = 110.0;
87 // When the event is initiated from HostZoomMap, the old zoom level is not 70 // When the event is initiated from HostZoomMap, the old zoom level is not
88 // available. 71 // available.
89 ZoomController::ZoomChangedEventData zoom_change_data( 72 ZoomController::ZoomChangedEventData zoom_change_data(
90 web_contents(), 73 web_contents(),
91 new_zoom_level, 74 new_zoom_level,
92 new_zoom_level, 75 new_zoom_level,
93 ZoomController::ZOOM_MODE_DEFAULT, 76 ZoomController::ZOOM_MODE_DEFAULT,
94 false); 77 false);
(...skipping 23 matching lines...) Expand all
118 ZoomController::ZoomChangedEventData zoom_change_data2( 101 ZoomController::ZoomChangedEventData zoom_change_data2(
119 web_contents(), 102 web_contents(),
120 old_zoom_level, 103 old_zoom_level,
121 new_zoom_level, 104 new_zoom_level,
122 ZoomController::ZOOM_MODE_ISOLATED, 105 ZoomController::ZOOM_MODE_ISOLATED,
123 false /* can_show_bubble */); 106 false /* can_show_bubble */);
124 EXPECT_CALL(zoom_observer_, OnZoomChanged(zoom_change_data2)).Times(1); 107 EXPECT_CALL(zoom_observer_, OnZoomChanged(zoom_change_data2)).Times(1);
125 108
126 zoom_controller_->SetZoomLevel(new_zoom_level); 109 zoom_controller_->SetZoomLevel(new_zoom_level);
127 } 110 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/zoom/zoom_controller_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698