| OLD | NEW |
| 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 18 matching lines...) Expand all Loading... |
| 29 } | 29 } |
| 30 | 30 |
| 31 class TestZoomObserver : public ZoomObserver { | 31 class TestZoomObserver : public ZoomObserver { |
| 32 public: | 32 public: |
| 33 MOCK_METHOD1(OnZoomChanged, | 33 MOCK_METHOD1(OnZoomChanged, |
| 34 void(const ZoomController::ZoomChangedEventData&)); | 34 void(const ZoomController::ZoomChangedEventData&)); |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 class ZoomControllerTest : public ChromeRenderViewHostTestHarness { | 37 class ZoomControllerTest : public ChromeRenderViewHostTestHarness { |
| 38 public: | 38 public: |
| 39 virtual void SetUp() OVERRIDE { | 39 virtual void SetUp() override { |
| 40 ChromeRenderViewHostTestHarness::SetUp(); | 40 ChromeRenderViewHostTestHarness::SetUp(); |
| 41 zoom_controller_.reset(new ZoomController(web_contents())); | 41 zoom_controller_.reset(new ZoomController(web_contents())); |
| 42 zoom_controller_->AddObserver(&zoom_observer_); | 42 zoom_controller_->AddObserver(&zoom_observer_); |
| 43 | 43 |
| 44 // This call is needed so that the RenderViewHost reports being alive. This | 44 // This call is needed so that the RenderViewHost reports being alive. This |
| 45 // is only important for tests that call ZoomController::SetZoomLevel(). | 45 // is only important for tests that call ZoomController::SetZoomLevel(). |
| 46 content::RenderViewHostTester::For(rvh())->CreateRenderView( | 46 content::RenderViewHostTester::For(rvh())->CreateRenderView( |
| 47 base::string16(), MSG_ROUTING_NONE, MSG_ROUTING_NONE, -1, false); | 47 base::string16(), MSG_ROUTING_NONE, MSG_ROUTING_NONE, -1, false); |
| 48 } | 48 } |
| 49 | 49 |
| 50 virtual void TearDown() OVERRIDE { | 50 virtual void TearDown() override { |
| 51 zoom_controller_->RemoveObserver(&zoom_observer_); | 51 zoom_controller_->RemoveObserver(&zoom_observer_); |
| 52 zoom_controller_.reset(); | 52 zoom_controller_.reset(); |
| 53 ChromeRenderViewHostTestHarness::TearDown(); | 53 ChromeRenderViewHostTestHarness::TearDown(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 protected: | 56 protected: |
| 57 scoped_ptr<ZoomController> zoom_controller_; | 57 scoped_ptr<ZoomController> zoom_controller_; |
| 58 TestZoomObserver zoom_observer_; | 58 TestZoomObserver zoom_observer_; |
| 59 }; | 59 }; |
| 60 | 60 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 ZoomController::ZoomChangedEventData zoom_change_data2( | 109 ZoomController::ZoomChangedEventData zoom_change_data2( |
| 110 web_contents(), | 110 web_contents(), |
| 111 old_zoom_level, | 111 old_zoom_level, |
| 112 new_zoom_level, | 112 new_zoom_level, |
| 113 ZoomController::ZOOM_MODE_ISOLATED, | 113 ZoomController::ZOOM_MODE_ISOLATED, |
| 114 true /* can_show_bubble */); | 114 true /* can_show_bubble */); |
| 115 EXPECT_CALL(zoom_observer_, OnZoomChanged(zoom_change_data2)).Times(1); | 115 EXPECT_CALL(zoom_observer_, OnZoomChanged(zoom_change_data2)).Times(1); |
| 116 | 116 |
| 117 zoom_controller_->SetZoomLevel(new_zoom_level); | 117 zoom_controller_->SetZoomLevel(new_zoom_level); |
| 118 } | 118 } |
| OLD | NEW |