[Cronet] Delay StartNetLog and StopNetLog until native request context is initialized
[chromium-blink-merge.git] / ui / gfx / shadow_value_unittest.cc
blob8caec8a1849f225df1d6c6ac7d3b1d63f9bd5f62
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.
5 #include "base/basictypes.h"
6 #include "testing/gtest/include/gtest/gtest.h"
7 #include "ui/gfx/geometry/insets.h"
8 #include "ui/gfx/geometry/vector2d.h"
9 #include "ui/gfx/shadow_value.h"
11 namespace gfx {
13 TEST(ShadowValueTest, GetMargin) {
14 const struct TestCase {
15 Insets expected_margin;
16 size_t shadow_count;
17 ShadowValue shadows[2];
18 } kTestCases[] = {
20 Insets(), 0, {},
23 Insets(-2, -2, -2, -2),
25 { ShadowValue(gfx::Vector2d(0, 0), 4, 0), },
28 Insets(0, -1, -4, -3),
30 { ShadowValue(gfx::Vector2d(1, 2), 4, 0), },
33 Insets(-4, -3, 0, -1),
35 { ShadowValue(gfx::Vector2d(-1, -2), 4, 0), },
38 Insets(0, -1, -5, -4),
41 ShadowValue(gfx::Vector2d(1, 2), 4, 0),
42 ShadowValue(gfx::Vector2d(2, 3), 4, 0),
46 Insets(-4, -3, -5, -4),
49 ShadowValue(gfx::Vector2d(-1, -2), 4, 0),
50 ShadowValue(gfx::Vector2d(2, 3), 4, 0),
55 for (size_t i = 0; i < arraysize(kTestCases); ++i) {
56 Insets margin = ShadowValue::GetMargin(
57 ShadowValues(kTestCases[i].shadows,
58 kTestCases[i].shadows + kTestCases[i].shadow_count));
60 EXPECT_EQ(kTestCases[i].expected_margin, margin) << " i=" << i;
64 } // namespace gfx