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

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

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
« no previous file with comments | « chrome/browser/ui/zoom/zoom_controller_browsertest.cc ('k') | chrome/chrome_browser_ui.gypi » ('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 "base/message_loop/message_loop.h" 5 #include "base/message_loop/message_loop.h"
6 #include "chrome/browser/ui/browser.h" 6 #include "chrome/browser/ui/browser.h"
7 #include "chrome/browser/ui/browser_finder.h" 7 #include "chrome/browser/ui/browser_finder.h"
8 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 8 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
9 #include "chrome/test/base/testing_profile.h" 9 #include "chrome/test/base/testing_profile.h"
10 #include "components/prefs/pref_service.h" 10 #include "components/prefs/pref_service.h"
11 #include "components/ui/zoom/test/zoom_test_utils.h" 11 #include "components/zoom/test/zoom_test_utils.h"
12 #include "components/ui/zoom/zoom_controller.h" 12 #include "components/zoom/zoom_controller.h"
13 #include "components/ui/zoom/zoom_observer.h" 13 #include "components/zoom/zoom_observer.h"
14 #include "content/public/browser/host_zoom_map.h" 14 #include "content/public/browser/host_zoom_map.h"
15 #include "content/public/browser/navigation_details.h" 15 #include "content/public/browser/navigation_details.h"
16 #include "content/public/common/frame_navigate_params.h" 16 #include "content/public/common/frame_navigate_params.h"
17 #include "content/public/test/test_renderer_host.h" 17 #include "content/public/test/test_renderer_host.h"
18 #include "content/public/test/test_utils.h" 18 #include "content/public/test/test_utils.h"
19 #include "ipc/ipc_message.h" 19 #include "ipc/ipc_message.h"
20 #include "testing/gmock/include/gmock/gmock.h" 20 #include "testing/gmock/include/gmock/gmock.h"
21 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
22 22
23 using ui_zoom::ZoomChangedWatcher; 23 using zoom::ZoomChangedWatcher;
24 using ui_zoom::ZoomController; 24 using zoom::ZoomController;
25 25
26 class ZoomControllerTest : public ChromeRenderViewHostTestHarness { 26 class ZoomControllerTest : public ChromeRenderViewHostTestHarness {
27 public: 27 public:
28 void SetUp() override { 28 void SetUp() override {
29 ChromeRenderViewHostTestHarness::SetUp(); 29 ChromeRenderViewHostTestHarness::SetUp();
30 zoom_controller_.reset(new ZoomController(web_contents())); 30 zoom_controller_.reset(new ZoomController(web_contents()));
31 31
32 // This call is needed so that the RenderViewHost reports being alive. This 32 // This call is needed so that the RenderViewHost reports being alive. This
33 // is only important for tests that call ZoomController::SetZoomLevel(). 33 // is only important for tests that call ZoomController::SetZoomLevel().
34 content::RenderViewHostTester::For(rvh())->CreateTestRenderView( 34 content::RenderViewHostTester::For(rvh())->CreateTestRenderView(
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 zoom_change_watcher2.Wait(); 93 zoom_change_watcher2.Wait();
94 } 94 }
95 } 95 }
96 96
97 TEST_F(ZoomControllerTest, ObserveManualZoomCanShowBubble) { 97 TEST_F(ZoomControllerTest, ObserveManualZoomCanShowBubble) {
98 NavigateAndCommit(GURL("about:blank")); 98 NavigateAndCommit(GURL("about:blank"));
99 double old_zoom_level = zoom_controller_->GetZoomLevel(); 99 double old_zoom_level = zoom_controller_->GetZoomLevel();
100 double new_zoom_level1 = old_zoom_level + 0.5; 100 double new_zoom_level1 = old_zoom_level + 0.5;
101 double new_zoom_level2 = old_zoom_level + 1.0; 101 double new_zoom_level2 = old_zoom_level + 1.0;
102 102
103 zoom_controller_->SetZoomMode(ui_zoom::ZoomController::ZOOM_MODE_MANUAL); 103 zoom_controller_->SetZoomMode(zoom::ZoomController::ZOOM_MODE_MANUAL);
104 // By default, the zoom controller will send 'true' for can_show_bubble. 104 // By default, the zoom controller will send 'true' for can_show_bubble.
105 ZoomController::ZoomChangedEventData zoom_change_data1( 105 ZoomController::ZoomChangedEventData zoom_change_data1(
106 web_contents(), 106 web_contents(),
107 old_zoom_level, 107 old_zoom_level,
108 new_zoom_level1, 108 new_zoom_level1,
109 ZoomController::ZOOM_MODE_MANUAL, 109 ZoomController::ZOOM_MODE_MANUAL,
110 true /* can_show_bubble */); 110 true /* can_show_bubble */);
111 { 111 {
112 ZoomChangedWatcher zoom_change_watcher1(zoom_controller_.get(), 112 ZoomChangedWatcher zoom_change_watcher1(zoom_controller_.get(),
113 zoom_change_data1); 113 zoom_change_data1);
(...skipping 10 matching lines...) Expand all
124 ZoomController::ZOOM_MODE_MANUAL, 124 ZoomController::ZOOM_MODE_MANUAL,
125 false /* can_show_bubble */); 125 false /* can_show_bubble */);
126 { 126 {
127 ZoomChangedWatcher zoom_change_watcher2(zoom_controller_.get(), 127 ZoomChangedWatcher zoom_change_watcher2(zoom_controller_.get(),
128 zoom_change_data2); 128 zoom_change_data2);
129 zoom_controller_->SetZoomLevel(new_zoom_level2); 129 zoom_controller_->SetZoomLevel(new_zoom_level2);
130 zoom_change_watcher2.Wait(); 130 zoom_change_watcher2.Wait();
131 } 131 }
132 132
133 } 133 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/zoom/zoom_controller_browsertest.cc ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698