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

Side by Side Diff: chrome/browser/themes/browser_theme_pack_unittest.cc

Issue 925783002: Split ValueSerializer into separate Serializer and Deserializer classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed cpplint warnings. Created 5 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 (c) 2012 The Chromium Authors. All rights reserved. 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 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 "chrome/browser/themes/browser_theme_pack.h" 5 #include "chrome/browser/themes/browser_theme_pack.h"
6 6
7 #include "base/files/scoped_temp_dir.h" 7 #include "base/files/scoped_temp_dir.h"
8 #include "base/json/json_file_value_serializer.h" 8 #include "base/json/json_file_value_serializer.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 &theme_pack_->images_on_ui_thread_); 147 &theme_pack_->images_on_ui_thread_);
148 } 148 }
149 149
150 // This function returns void in order to be able use ASSERT_... 150 // This function returns void in order to be able use ASSERT_...
151 // The BrowserThemePack is returned in |pack|. 151 // The BrowserThemePack is returned in |pack|.
152 void BuildFromUnpackedExtension(const base::FilePath& extension_path, 152 void BuildFromUnpackedExtension(const base::FilePath& extension_path,
153 scoped_refptr<BrowserThemePack>& pack) { 153 scoped_refptr<BrowserThemePack>& pack) {
154 base::FilePath manifest_path = 154 base::FilePath manifest_path =
155 extension_path.AppendASCII("manifest.json"); 155 extension_path.AppendASCII("manifest.json");
156 std::string error; 156 std::string error;
157 JSONFileValueSerializer serializer(manifest_path); 157 JSONFileValueDeserializer deserializer(manifest_path);
158 scoped_ptr<base::DictionaryValue> valid_value( 158 scoped_ptr<base::DictionaryValue> valid_value(
159 static_cast<base::DictionaryValue*>( 159 static_cast<base::DictionaryValue*>(
160 serializer.Deserialize(NULL, &error))); 160 deserializer.Deserialize(NULL, &error)));
161 EXPECT_EQ("", error); 161 EXPECT_EQ("", error);
162 ASSERT_TRUE(valid_value.get()); 162 ASSERT_TRUE(valid_value.get());
163 scoped_refptr<Extension> extension( 163 scoped_refptr<Extension> extension(
164 Extension::Create( 164 Extension::Create(
165 extension_path, 165 extension_path,
166 extensions::Manifest::INVALID_LOCATION, 166 extensions::Manifest::INVALID_LOCATION,
167 *valid_value, 167 *valid_value,
168 Extension::REQUIRE_KEY, 168 Extension::REQUIRE_KEY,
169 &error)); 169 &error));
170 ASSERT_TRUE(extension.get()); 170 ASSERT_TRUE(extension.get());
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 } 622 }
623 623
624 // Part 2: Try to read back the data pack that we just wrote to disk. 624 // Part 2: Try to read back the data pack that we just wrote to disk.
625 { 625 {
626 scoped_refptr<BrowserThemePack> pack = 626 scoped_refptr<BrowserThemePack> pack =
627 BrowserThemePack::BuildFromDataPack(file, "gllekhaobjnhgeag"); 627 BrowserThemePack::BuildFromDataPack(file, "gllekhaobjnhgeag");
628 ASSERT_TRUE(pack.get()); 628 ASSERT_TRUE(pack.get());
629 VerifyHiDpiTheme(pack.get()); 629 VerifyHiDpiTheme(pack.get());
630 } 630 }
631 } 631 }
OLDNEW
« no previous file with comments | « chrome/browser/supervised_user/supervised_user_site_list.cc ('k') | chrome/browser/ui/app_list/start_page_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698