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

Side by Side Diff: content/browser/host_zoom_map_impl_unittest.cc

Issue 11866004: Add scheme to HostZoomMap (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix alignment, add comment Created 7 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "content/browser/host_zoom_map_impl.h" 5 #include "content/browser/host_zoom_map_impl.h"
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 #include "content/public/test/test_browser_thread.h" 10 #include "content/public/test/test_browser_thread.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 namespace content { 13 namespace content {
14 14
15 class HostZoomMapTest : public testing::Test { 15 class HostZoomMapTest : public testing::Test {
16 public: 16 public:
17 HostZoomMapTest() : ui_thread_(BrowserThread::UI, &message_loop_) { 17 HostZoomMapTest() : ui_thread_(BrowserThread::UI, &message_loop_) {
18 } 18 }
19 19
20 protected: 20 protected:
21 MessageLoop message_loop_; 21 MessageLoop message_loop_;
22 TestBrowserThread ui_thread_; 22 TestBrowserThread ui_thread_;
23 }; 23 };
24 24
25 TEST_F(HostZoomMapTest, GetSetZoomLevel) { 25 TEST_F(HostZoomMapTest, GetSetZoomLevel) {
26 HostZoomMapImpl host_zoom_map; 26 HostZoomMapImpl host_zoom_map;
27 27
28 double zoomed = 2.5; 28 double zoomed = 2.5;
29 host_zoom_map.SetZoomLevel("zoomed.com", zoomed); 29 host_zoom_map.SetZoomLevelForHost("zoomed.com", zoomed);
30 30
31 EXPECT_DOUBLE_EQ(host_zoom_map.GetZoomLevel("normal.com"), 0); 31 EXPECT_DOUBLE_EQ(0, host_zoom_map.GetZoomLevelForHost("normal.com"));
32 EXPECT_DOUBLE_EQ(host_zoom_map.GetZoomLevel("zoomed.com"), zoomed); 32 EXPECT_DOUBLE_EQ(zoomed,
33 host_zoom_map.GetZoomLevelForHost("zoomed.com"));
34 }
35
36 TEST_F(HostZoomMapTest, GetSetZoomLevelWithScheme) {
37 HostZoomMapImpl host_zoom_map;
38
39 double zoomed = 2.5;
40 double default_zoom = 1.5;
41
42 host_zoom_map.SetZoomLevelForHostAndScheme("chrome", "login", 0);
43
44 host_zoom_map.SetDefaultZoomLevel(default_zoom);
45
46 EXPECT_DOUBLE_EQ(0,
47 host_zoom_map.GetZoomLevelForHostAndScheme("chrome", "login"));
48 EXPECT_DOUBLE_EQ(default_zoom,
49 host_zoom_map.GetZoomLevelForHostAndScheme("http", "login"));
50
51 host_zoom_map.SetZoomLevelForHost("login", zoomed);
52
53 EXPECT_DOUBLE_EQ(0,
54 host_zoom_map.GetZoomLevelForHostAndScheme("chrome", "login"));
55 EXPECT_DOUBLE_EQ(zoomed,
56 host_zoom_map.GetZoomLevelForHostAndScheme("http", "login"));
33 } 57 }
34 58
35 } // namespace content 59 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698