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

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

Issue 2662503002: Convert StartPageService and ZoomController to use the new navigation callbacks. (Closed)
Patch Set: fix unittest Created 3 years, 10 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 (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/zoom/test/zoom_test_utils.h" 11 #include "components/zoom/test/zoom_test_utils.h"
12 #include "components/zoom/zoom_controller.h" 12 #include "components/zoom/zoom_controller.h"
13 #include "components/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_handle.h"
16 #include "content/public/common/frame_navigate_params.h"
17 #include "content/public/test/test_renderer_host.h" 16 #include "content/public/test/test_renderer_host.h"
18 #include "content/public/test/test_utils.h" 17 #include "content/public/test/test_utils.h"
19 #include "ipc/ipc_message.h" 18 #include "ipc/ipc_message.h"
20 #include "testing/gmock/include/gmock/gmock.h" 19 #include "testing/gmock/include/gmock/gmock.h"
21 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
22 21
23 using zoom::ZoomChangedWatcher; 22 using zoom::ZoomChangedWatcher;
24 using zoom::ZoomController; 23 using zoom::ZoomController;
25 24
26 class ZoomControllerTest : public ChromeRenderViewHostTestHarness { 25 class ZoomControllerTest : public ChromeRenderViewHostTestHarness {
(...skipping 20 matching lines...) Expand all
47 TEST_F(ZoomControllerTest, DidNavigateMainFrame) { 46 TEST_F(ZoomControllerTest, DidNavigateMainFrame) {
48 double zoom_level = zoom_controller_->GetZoomLevel(); 47 double zoom_level = zoom_controller_->GetZoomLevel();
49 ZoomController::ZoomChangedEventData zoom_change_data( 48 ZoomController::ZoomChangedEventData zoom_change_data(
50 web_contents(), 49 web_contents(),
51 zoom_level, 50 zoom_level,
52 zoom_level, 51 zoom_level,
53 ZoomController::ZOOM_MODE_DEFAULT, 52 ZoomController::ZOOM_MODE_DEFAULT,
54 false); 53 false);
55 ZoomChangedWatcher zoom_change_watcher(zoom_controller_.get(), 54 ZoomChangedWatcher zoom_change_watcher(zoom_controller_.get(),
56 zoom_change_data); 55 zoom_change_data);
57 zoom_controller_->DidNavigateMainFrame(content::LoadCommittedDetails(), 56 std::unique_ptr<content::NavigationHandle> navigation_handle =
58 content::FrameNavigateParams()); 57 content::NavigationHandle::CreateNavigationHandleForTesting(
58 GURL(), rvh()->GetMainFrame(), true);
59 zoom_controller_->DidFinishNavigation(navigation_handle.get());
59 zoom_change_watcher.Wait(); 60 zoom_change_watcher.Wait();
60 } 61 }
61 62
62 TEST_F(ZoomControllerTest, Observe_ZoomController) { 63 TEST_F(ZoomControllerTest, Observe_ZoomController) {
63 double old_zoom_level = zoom_controller_->GetZoomLevel(); 64 double old_zoom_level = zoom_controller_->GetZoomLevel();
64 double new_zoom_level = 110.0; 65 double new_zoom_level = 110.0;
65 66
66 NavigateAndCommit(GURL("about:blank")); 67 NavigateAndCommit(GURL("about:blank"));
67 68
68 ZoomController::ZoomChangedEventData zoom_change_data1( 69 ZoomController::ZoomChangedEventData zoom_change_data1(
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 ZoomController::ZOOM_MODE_MANUAL, 125 ZoomController::ZOOM_MODE_MANUAL,
125 false /* can_show_bubble */); 126 false /* can_show_bubble */);
126 { 127 {
127 ZoomChangedWatcher zoom_change_watcher2(zoom_controller_.get(), 128 ZoomChangedWatcher zoom_change_watcher2(zoom_controller_.get(),
128 zoom_change_data2); 129 zoom_change_data2);
129 zoom_controller_->SetZoomLevel(new_zoom_level2); 130 zoom_controller_->SetZoomLevel(new_zoom_level2);
130 zoom_change_watcher2.Wait(); 131 zoom_change_watcher2.Wait();
131 } 132 }
132 133
133 } 134 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698