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

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

Issue 11299014: [zoom bubble] Fix my stupidity and restore the proper host handling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test Created 8 years, 1 month 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/zoom/zoom_controller.h"
6 #include "chrome/browser/ui/zoom/zoom_observer.h"
7 #include "chrome/common/pref_names.h"
8 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
9 #include "content/public/browser/browser_thread.h"
10 #include "content/public/browser/navigation_details.h"
11 #include "content/public/browser/notification_details.h"
12 #include "content/public/browser/notification_source.h"
13 #include "content/public/browser/notification_types.h"
14 #include "content/public/common/frame_navigate_params.h"
15 #include "content/public/test/test_browser_thread.h"
16 #include "content/public/test/test_renderer_host.h"
17 #include "testing/gmock/include/gmock/gmock.h"
18 #include "testing/gtest/include/gtest/gtest.h"
19
20 typedef ChromeRenderViewHostTestHarness ZoomControllerTest;
21
22 class TestZoomObserver : public ZoomObserver {
23 public:
24 MOCK_METHOD2(OnZoomChanged, void(content::WebContents*, bool));
25 };
26
27 TEST_F(ZoomControllerTest, DidNavigateMainFrame) {
28 ZoomController zoom_controller(web_contents());
29
30 TestZoomObserver zoom_observer;
31 zoom_controller.set_observer(&zoom_observer);
32
33 EXPECT_CALL(zoom_observer, OnZoomChanged(web_contents(), false)).Times(1);
34
35 zoom_controller.DidNavigateMainFrame(content::LoadCommittedDetails(),
36 content::FrameNavigateParams());
37 }
38
39 TEST_F(ZoomControllerTest, OnPreferenceChanged) {
40 ZoomController zoom_controller(web_contents());
41
42 TestZoomObserver zoom_observer;
43 zoom_controller.set_observer(&zoom_observer);
44
45 EXPECT_CALL(zoom_observer, OnZoomChanged(web_contents(), false)).Times(1);
46
47 zoom_controller.OnPreferenceChanged(NULL, prefs::kDefaultZoomLevel);
48 }
49
50 TEST_F(ZoomControllerTest, Observe) {
51 ZoomController zoom_controller(web_contents());
52
53 TestZoomObserver zoom_observer;
54 zoom_controller.set_observer(&zoom_observer);
55
56 EXPECT_CALL(zoom_observer, OnZoomChanged(web_contents(), false)).Times(1);
57
58 std::string host;
59 zoom_controller.Observe(content::NOTIFICATION_ZOOM_LEVEL_CHANGED,
60 content::Source<content::WebContents>(web_contents()),
61 content::Details<std::string>(&host));
62 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698