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

Side by Side Diff: extensions/browser/value_store/value_store_frontend_unittest.cc

Issue 2664753002: Remove base::StringValue (Closed)
Patch Set: Rebase Created 3 years, 9 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 2014 The Chromium Authors. All rights reserved. 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 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 "extensions/browser/value_store/value_store_frontend.h" 5 #include "extensions/browser/value_store/value_store_frontend.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 { 89 {
90 ASSERT_TRUE(Get("key2", &value)); 90 ASSERT_TRUE(Get("key2", &value));
91 int result; 91 int result;
92 ASSERT_TRUE(value->GetAsInteger(&result)); 92 ASSERT_TRUE(value->GetAsInteger(&result));
93 EXPECT_EQ(2, result); 93 EXPECT_EQ(2, result);
94 } 94 }
95 } 95 }
96 96
97 TEST_F(ValueStoreFrontendTest, ChangesPersistAfterReload) { 97 TEST_F(ValueStoreFrontendTest, ChangesPersistAfterReload) {
98 storage_->Set("key0", std::unique_ptr<base::Value>(new base::Value(0))); 98 storage_->Set("key0", std::unique_ptr<base::Value>(new base::Value(0)));
99 storage_->Set("key1", 99 storage_->Set("key1", std::unique_ptr<base::Value>(new base::Value("new1")));
100 std::unique_ptr<base::Value>(new base::StringValue("new1")));
101 storage_->Remove("key2"); 100 storage_->Remove("key2");
102 101
103 // Reload the DB and test our changes. 102 // Reload the DB and test our changes.
104 ResetStorage(); 103 ResetStorage();
105 104
106 std::unique_ptr<base::Value> value; 105 std::unique_ptr<base::Value> value;
107 { 106 {
108 ASSERT_TRUE(Get("key0", &value)); 107 ASSERT_TRUE(Get("key0", &value));
109 int result; 108 int result;
110 ASSERT_TRUE(value->GetAsInteger(&result)); 109 ASSERT_TRUE(value->GetAsInteger(&result));
111 EXPECT_EQ(0, result); 110 EXPECT_EQ(0, result);
112 } 111 }
113 112
114 { 113 {
115 ASSERT_TRUE(Get("key1", &value)); 114 ASSERT_TRUE(Get("key1", &value));
116 std::string result; 115 std::string result;
117 ASSERT_TRUE(value->GetAsString(&result)); 116 ASSERT_TRUE(value->GetAsString(&result));
118 EXPECT_EQ("new1", result); 117 EXPECT_EQ("new1", result);
119 } 118 }
120 119
121 ASSERT_FALSE(Get("key2", &value)); 120 ASSERT_FALSE(Get("key2", &value));
122 } 121 }
OLDNEW
« no previous file with comments | « extensions/browser/value_store/value_store_change_unittest.cc ('k') | extensions/browser/value_store/value_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698