OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 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 | |
6 #include "chrome/browser/thumbnails/thumbnailing_context.h" | |
7 | |
8 #include "testing/gtest/include/gtest/gtest.h" | |
9 | |
10 namespace thumbnails { | |
11 | |
12 typedef testing::Test ThumbnailingContextTest; | |
13 | |
14 TEST_F(ThumbnailingContextTest, TestClipResult) { | |
15 scoped_refptr<ThumbnailingContext> context( | |
16 ThumbnailingContext::CreateThumbnailingContextForTest()); | |
17 | |
18 // Set it to something. | |
19 context->set_clip_result(CLIP_RESULT_SOURCE_IS_SMALLER); | |
20 EXPECT_EQ(context->clip_result(), CLIP_RESULT_SOURCE_IS_SMALLER); | |
21 | |
22 // Make sure it's possible to change it. | |
23 context->set_clip_result(CLIP_RESULT_TALLER_THAN_WIDE); | |
24 EXPECT_EQ(context->clip_result(), CLIP_RESULT_TALLER_THAN_WIDE); | |
25 } | |
26 | |
27 TEST_F(ThumbnailingContextTest, TestRequestedCopySize) { | |
28 scoped_refptr<ThumbnailingContext> context( | |
29 ThumbnailingContext::CreateThumbnailingContextForTest()); | |
30 | |
31 // Set it to a size. | |
32 gfx::Size the_size(25, 50); | |
33 context->set_requested_copy_size(the_size); | |
34 EXPECT_TRUE(context->requested_copy_size() == the_size); | |
35 | |
36 // Try changing to a new size. | |
37 the_size.set_height(500); | |
38 context->set_requested_copy_size(the_size); | |
39 EXPECT_TRUE(context->requested_copy_size() == the_size); | |
40 } | |
41 | |
42 TEST_F(ThumbnailingContextTest, TestBoringScore) { | |
43 scoped_refptr<ThumbnailingContext> context( | |
44 ThumbnailingContext::CreateThumbnailingContextForTest()); | |
45 | |
46 // Set it to something. | |
47 double boring_score = 50.0; | |
48 context->SetBoringScore(boring_score); | |
49 EXPECT_TRUE(context->score().boring_score == boring_score); | |
Lei Zhang
2015/11/02 22:41:30
EXPECT_EQ(expected, actual);
Ditto all around.
shrike
2015/11/03 18:36:23
Acknowledged.
Lei Zhang
2015/11/03 18:59:24
You've written EXPECT_EQ(actual, expected). In thi
shrike
2015/11/03 19:10:49
Thank you for catching that.
| |
50 | |
51 // Try changing it. | |
52 boring_score = 25.0; | |
53 context->SetBoringScore(boring_score); | |
54 EXPECT_TRUE(context->score().boring_score == boring_score); | |
55 } | |
56 | |
57 TEST_F(ThumbnailingContextTest, TestGoodClipping) { | |
58 scoped_refptr<ThumbnailingContext> context( | |
59 ThumbnailingContext::CreateThumbnailingContextForTest()); | |
60 | |
61 // Set to true. | |
62 context->SetGoodClipping(true); | |
63 EXPECT_TRUE(context->score().good_clipping); | |
64 | |
65 // Try changing to false. | |
66 context->SetGoodClipping(false); | |
67 EXPECT_FALSE(context->score().good_clipping); | |
68 } | |
69 | |
70 } // namespace thumbnails | |
OLD | NEW |