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

Side by Side Diff: chrome/browser/devtools/devtools_contents_resizing_strategy_unittest.cc

Issue 440663003: DevTools: remove unused resizing strategy code paths, make it solely bounds-based. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for landing Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 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/devtools/devtools_contents_resizing_strategy.h"
6
7 #include "testing/gtest/include/gtest/gtest.h"
8
9 TEST(DevToolsContentsResizingStrategyTest, ApplyZero) {
10 DevToolsContentsResizingStrategy zeroStrategy;
11 gfx::Size container_size(100, 200);
12 gfx::Rect old_devtools_bounds(0, 0, 100, 200);
13 gfx::Rect old_contents_bounds(20, 20, 60, 140);
14 gfx::Rect new_devtools_bounds;
15 gfx::Rect new_contents_bounds;
16 ApplyDevToolsContentsResizingStrategy(
17 zeroStrategy, container_size,
18 old_devtools_bounds, old_contents_bounds,
19 &new_devtools_bounds, &new_contents_bounds);
20 EXPECT_EQ(gfx::Rect(0, 0, 100, 200), new_devtools_bounds);
21 EXPECT_EQ(gfx::Rect(0, 0, 100, 200), new_contents_bounds);
22 }
23
24 TEST(DevToolsContentsResizingStrategyTest, ApplyInsets) {
25 DevToolsContentsResizingStrategy strategy(
26 gfx::Insets(10, 20, 30, 40), gfx::Size(0, 0));
27 gfx::Size container_size(100, 200);
28 gfx::Rect old_devtools_bounds(0, 0, 100, 200);
29 gfx::Rect old_contents_bounds(20, 20, 60, 140);
30 gfx::Rect new_devtools_bounds;
31 gfx::Rect new_contents_bounds;
32 ApplyDevToolsContentsResizingStrategy(
33 strategy, container_size,
34 old_devtools_bounds, old_contents_bounds,
35 &new_devtools_bounds, &new_contents_bounds);
36 EXPECT_EQ(gfx::Rect(0, 0, 100, 200), new_devtools_bounds);
37 EXPECT_EQ(gfx::Rect(20, 10, 40, 160), new_contents_bounds);
38 }
39
40 TEST(DevToolsContentsResizingStrategyTest, ApplyMinSize) {
41 DevToolsContentsResizingStrategy strategy(
42 gfx::Insets(10, 20, 90, 30), gfx::Size(60, 120));
43 gfx::Size container_size(100, 200);
44 gfx::Rect old_devtools_bounds(0, 0, 100, 200);
45 gfx::Rect old_contents_bounds(20, 20, 60, 140);
46 gfx::Rect new_devtools_bounds;
47 gfx::Rect new_contents_bounds;
48 ApplyDevToolsContentsResizingStrategy(
49 strategy, container_size,
50 old_devtools_bounds, old_contents_bounds,
51 &new_devtools_bounds, &new_contents_bounds);
52 EXPECT_EQ(gfx::Rect(0, 0, 100, 200), new_devtools_bounds);
53 EXPECT_EQ(gfx::Rect(16, 8, 60, 120), new_contents_bounds);
54 }
55
56 TEST(DevToolsContentsResizingStrategyTest, ApplyLargeInset) {
57 DevToolsContentsResizingStrategy strategy(
58 gfx::Insets(0, 130, 0, 0), gfx::Size(60, 120));
59 gfx::Size container_size(100, 200);
60 gfx::Rect old_devtools_bounds(0, 0, 100, 200);
61 gfx::Rect old_contents_bounds(20, 20, 60, 140);
62 gfx::Rect new_devtools_bounds;
63 gfx::Rect new_contents_bounds;
64 ApplyDevToolsContentsResizingStrategy(
65 strategy, container_size,
66 old_devtools_bounds, old_contents_bounds,
67 &new_devtools_bounds, &new_contents_bounds);
68 EXPECT_EQ(gfx::Rect(0, 0, 100, 200), new_devtools_bounds);
69 EXPECT_EQ(gfx::Rect(40, 0, 60, 200), new_contents_bounds);
70 }
71
72 TEST(DevToolsContentsResizingStrategyTest, ApplyTwoLargeInsets) {
73 DevToolsContentsResizingStrategy strategy(
74 gfx::Insets(120, 0, 80, 0), gfx::Size(60, 120));
75 gfx::Size container_size(100, 200);
76 gfx::Rect old_devtools_bounds(0, 0, 100, 200);
77 gfx::Rect old_contents_bounds(20, 20, 60, 140);
78 gfx::Rect new_devtools_bounds;
79 gfx::Rect new_contents_bounds;
80 ApplyDevToolsContentsResizingStrategy(
81 strategy, container_size,
82 old_devtools_bounds, old_contents_bounds,
83 &new_devtools_bounds, &new_contents_bounds);
84 EXPECT_EQ(gfx::Rect(0, 0, 100, 200), new_devtools_bounds);
85 EXPECT_EQ(gfx::Rect(0, 48, 100, 120), new_contents_bounds);
86 }
87
88 TEST(DevToolsContentsResizingStrategyTest, ApplySmallContainer) {
89 DevToolsContentsResizingStrategy strategy(
90 gfx::Insets(10, 10, 10, 10), gfx::Size(120, 230));
91 gfx::Size container_size(100, 200);
92 gfx::Rect old_devtools_bounds(0, 0, 100, 200);
93 gfx::Rect old_contents_bounds(20, 20, 60, 140);
94 gfx::Rect new_devtools_bounds;
95 gfx::Rect new_contents_bounds;
96 ApplyDevToolsContentsResizingStrategy(
97 strategy, container_size,
98 old_devtools_bounds, old_contents_bounds,
99 &new_devtools_bounds, &new_contents_bounds);
100 EXPECT_EQ(gfx::Rect(0, 0, 100, 200), new_devtools_bounds);
101 EXPECT_EQ(gfx::Rect(0, 0, 100, 200), new_contents_bounds);
102 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698