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

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/zoom_decoration_unittest.mm

Issue 2019423005: Move //components/ui/zoom to top-level under //components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/macros.h" 5 #include "base/macros.h"
6 #import "chrome/browser/ui/cocoa/location_bar/zoom_decoration.h" 6 #import "chrome/browser/ui/cocoa/location_bar/zoom_decoration.h"
7 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 7 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
8 #include "components/ui/zoom/zoom_controller.h" 8 #include "components/zoom/zoom_controller.h"
9 9
10 namespace { 10 namespace {
11 11
12 class ZoomDecorationTest : public ChromeRenderViewHostTestHarness {}; 12 class ZoomDecorationTest : public ChromeRenderViewHostTestHarness {};
13 13
14 class MockZoomDecoration : public ZoomDecoration { 14 class MockZoomDecoration : public ZoomDecoration {
15 public: 15 public:
16 explicit MockZoomDecoration(LocationBarViewMac* owner) 16 explicit MockZoomDecoration(LocationBarViewMac* owner)
17 : ZoomDecoration(owner), update_ui_count_(0) {} 17 : ZoomDecoration(owner), update_ui_count_(0) {}
18 bool ShouldShowDecoration() const override { return true; } 18 bool ShouldShowDecoration() const override { return true; }
19 void ShowAndUpdateUI(ui_zoom::ZoomController* zoom_controller, 19 void ShowAndUpdateUI(zoom::ZoomController* zoom_controller,
20 NSString* tooltip_string, 20 NSString* tooltip_string,
21 bool location_bar_is_dark) override { 21 bool location_bar_is_dark) override {
22 ++update_ui_count_; 22 ++update_ui_count_;
23 ZoomDecoration::ShowAndUpdateUI(zoom_controller, 23 ZoomDecoration::ShowAndUpdateUI(zoom_controller,
24 tooltip_string, 24 tooltip_string,
25 location_bar_is_dark); 25 location_bar_is_dark);
26 } 26 }
27 27
28 int update_ui_count_; 28 int update_ui_count_;
29 29
30 private: 30 private:
31 DISALLOW_COPY_AND_ASSIGN(MockZoomDecoration); 31 DISALLOW_COPY_AND_ASSIGN(MockZoomDecoration);
32 }; 32 };
33 33
34 class MockZoomController : public ui_zoom::ZoomController { 34 class MockZoomController : public zoom::ZoomController {
35 public: 35 public:
36 explicit MockZoomController(content::WebContents* web_contents) 36 explicit MockZoomController(content::WebContents* web_contents)
37 : ui_zoom::ZoomController(web_contents) {} 37 : zoom::ZoomController(web_contents) {}
38 int GetZoomPercent() const override { return zoom_percent_; } 38 int GetZoomPercent() const override { return zoom_percent_; }
39 39
40 int zoom_percent_; 40 int zoom_percent_;
41 41
42 private: 42 private:
43 DISALLOW_COPY_AND_ASSIGN(MockZoomController); 43 DISALLOW_COPY_AND_ASSIGN(MockZoomController);
44 }; 44 };
45 45
46 // Test that UpdateIfNecessary performs redraws only when the zoom percent 46 // Test that UpdateIfNecessary performs redraws only when the zoom percent
47 // changes. 47 // changes.
(...skipping 19 matching lines...) Expand all
67 EXPECT_EQ(2, decoration.update_ui_count_); 67 EXPECT_EQ(2, decoration.update_ui_count_);
68 68
69 // Always redraw if the default zoom changes. 69 // Always redraw if the default zoom changes.
70 decoration.UpdateIfNecessary(&controller, 70 decoration.UpdateIfNecessary(&controller,
71 /*default_zoom_changed=*/true, 71 /*default_zoom_changed=*/true,
72 false); 72 false);
73 EXPECT_EQ(3, decoration.update_ui_count_); 73 EXPECT_EQ(3, decoration.update_ui_count_);
74 } 74 }
75 75
76 } // namespace 76 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/location_bar/zoom_decoration_browsertest.mm ('k') | chrome/browser/ui/panels/panel_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698