OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "components/login/screens/screen_context.h" |
| 6 |
5 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> |
6 #include <vector> | 9 #include <vector> |
7 | 10 |
8 #include "base/memory/scoped_ptr.h" | |
9 #include "components/login/screens/screen_context.h" | |
10 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
11 | 12 |
12 namespace login { | 13 namespace login { |
13 | 14 |
14 class ScreenContextTest : public testing::Test { | 15 class ScreenContextTest : public testing::Test { |
15 public: | 16 public: |
16 ScreenContextTest() {} | 17 ScreenContextTest() {} |
17 ~ScreenContextTest() override {} | 18 ~ScreenContextTest() override {} |
18 | 19 |
19 void SetUp() override { context_.reset(new ScreenContext()); } | 20 void SetUp() override { context_.reset(new ScreenContext()); } |
20 | 21 |
21 void TearDown() override {} | 22 void TearDown() override {} |
22 | 23 |
23 protected: | 24 protected: |
24 ScreenContext& context() { return *context_.get(); } | 25 ScreenContext& context() { return *context_.get(); } |
25 | 26 |
26 private: | 27 private: |
27 scoped_ptr<ScreenContext> context_; | 28 std::unique_ptr<ScreenContext> context_; |
28 }; | 29 }; |
29 | 30 |
30 TEST_F(ScreenContextTest, Simple) { | 31 TEST_F(ScreenContextTest, Simple) { |
31 ASSERT_FALSE(context().HasChanges()); | 32 ASSERT_FALSE(context().HasChanges()); |
32 | 33 |
33 ASSERT_FALSE(context().HasKey("key0")); | 34 ASSERT_FALSE(context().HasKey("key0")); |
34 | 35 |
35 bool rv = context().SetBoolean("key0", true); | 36 bool rv = context().SetBoolean("key0", true); |
36 ASSERT_TRUE(rv); | 37 ASSERT_TRUE(rv); |
37 ASSERT_TRUE(context().HasKey("key0")); | 38 ASSERT_TRUE(context().HasKey("key0")); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 ASSERT_EQ("key1", keys[1]); | 146 ASSERT_EQ("key1", keys[1]); |
146 ASSERT_EQ("key2", keys[2]); | 147 ASSERT_EQ("key2", keys[2]); |
147 | 148 |
148 ASSERT_FALSE(context().HasChanges()); | 149 ASSERT_FALSE(context().HasChanges()); |
149 ASSERT_EQ("value0", context().GetString("key0")); | 150 ASSERT_EQ("value0", context().GetString("key0")); |
150 ASSERT_EQ(1, context().GetInteger("key1")); | 151 ASSERT_EQ(1, context().GetInteger("key1")); |
151 ASSERT_TRUE(context().GetBoolean("key2")); | 152 ASSERT_TRUE(context().GetBoolean("key2")); |
152 } | 153 } |
153 | 154 |
154 } // namespace login | 155 } // namespace login |
OLD | NEW |