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

Side by Side Diff: chrome/utility/importer/safari_importer_unittest.mm

Issue 641363003: Convert ARRAYSIZE_UNSAFE -> arraysize in chrome/, outside of chrome/browser/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « chrome/utility/importer/bookmarks_file_importer_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/utility/importer/safari_importer.h" 5 #include "chrome/utility/importer/safari_importer.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 GURL("http://www.webkit.org/blog/"), 130 GURL("http://www.webkit.org/blog/"),
131 base::string16(), 131 base::string16(),
132 ASCIIToUTF16("Surfin' Safari - The WebKit Blog") 132 ASCIIToUTF16("Surfin' Safari - The WebKit Blog")
133 }, 133 },
134 }; 134 };
135 135
136 scoped_refptr<SafariImporter> importer(GetSafariImporter()); 136 scoped_refptr<SafariImporter> importer(GetSafariImporter());
137 std::vector<ImportedBookmarkEntry> bookmarks; 137 std::vector<ImportedBookmarkEntry> bookmarks;
138 importer->ParseBookmarks(ASCIIToUTF16("Toolbar"), &bookmarks); 138 importer->ParseBookmarks(ASCIIToUTF16("Toolbar"), &bookmarks);
139 size_t num_bookmarks = bookmarks.size(); 139 size_t num_bookmarks = bookmarks.size();
140 ASSERT_EQ(ARRAYSIZE_UNSAFE(kImportedBookmarksData), num_bookmarks); 140 ASSERT_EQ(arraysize(kImportedBookmarksData), num_bookmarks);
141 141
142 for (size_t i = 0; i < num_bookmarks; ++i) { 142 for (size_t i = 0; i < num_bookmarks; ++i) {
143 ImportedBookmarkEntry& entry = bookmarks[i]; 143 ImportedBookmarkEntry& entry = bookmarks[i];
144 EXPECT_EQ(kImportedBookmarksData[i].in_toolbar, entry.in_toolbar); 144 EXPECT_EQ(kImportedBookmarksData[i].in_toolbar, entry.in_toolbar);
145 EXPECT_EQ(kImportedBookmarksData[i].url, entry.url); 145 EXPECT_EQ(kImportedBookmarksData[i].url, entry.url);
146 146
147 std::vector<base::string16> path; 147 std::vector<base::string16> path;
148 Tokenize(kImportedBookmarksData[i].path, ASCIIToUTF16("/"), &path); 148 Tokenize(kImportedBookmarksData[i].path, ASCIIToUTF16("/"), &path);
149 ASSERT_EQ(path.size(), entry.path.size()); 149 ASSERT_EQ(path.size(), entry.path.size());
150 for (size_t j = 0; j < path.size(); ++j) { 150 for (size_t j = 0; j < path.size(); ++j) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 base::string16(), 194 base::string16(),
195 ASCIIToUTF16("Surfin' Safari - The WebKit Blog") 195 ASCIIToUTF16("Surfin' Safari - The WebKit Blog")
196 }, 196 },
197 }; 197 };
198 198
199 scoped_refptr<SafariImporter> importer( 199 scoped_refptr<SafariImporter> importer(
200 GetSafariImporterWithPathSuffix("empty_bookmarks_menu")); 200 GetSafariImporterWithPathSuffix("empty_bookmarks_menu"));
201 std::vector<ImportedBookmarkEntry> bookmarks; 201 std::vector<ImportedBookmarkEntry> bookmarks;
202 importer->ParseBookmarks(ASCIIToUTF16("Toolbar"), &bookmarks); 202 importer->ParseBookmarks(ASCIIToUTF16("Toolbar"), &bookmarks);
203 size_t num_bookmarks = bookmarks.size(); 203 size_t num_bookmarks = bookmarks.size();
204 ASSERT_EQ(ARRAYSIZE_UNSAFE(kImportedBookmarksData), num_bookmarks); 204 ASSERT_EQ(arraysize(kImportedBookmarksData), num_bookmarks);
205 205
206 for (size_t i = 0; i < num_bookmarks; ++i) { 206 for (size_t i = 0; i < num_bookmarks; ++i) {
207 ImportedBookmarkEntry& entry = bookmarks[i]; 207 ImportedBookmarkEntry& entry = bookmarks[i];
208 EXPECT_EQ(kImportedBookmarksData[i].in_toolbar, entry.in_toolbar); 208 EXPECT_EQ(kImportedBookmarksData[i].in_toolbar, entry.in_toolbar);
209 EXPECT_EQ(kImportedBookmarksData[i].url, entry.url); 209 EXPECT_EQ(kImportedBookmarksData[i].url, entry.url);
210 210
211 std::vector<base::string16> path; 211 std::vector<base::string16> path;
212 Tokenize(kImportedBookmarksData[i].path, ASCIIToUTF16("/"), &path); 212 Tokenize(kImportedBookmarksData[i].path, ASCIIToUTF16("/"), &path);
213 ASSERT_EQ(path.size(), entry.path.size()); 213 ASSERT_EQ(path.size(), entry.path.size());
214 for (size_t j = 0; j < path.size(); ++j) { 214 for (size_t j = 0; j < path.size(); ++j) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 EXPECT_EQ(items & importer::COOKIES, importer::NONE); 262 EXPECT_EQ(items & importer::COOKIES, importer::NONE);
263 EXPECT_EQ(items & importer::PASSWORDS, importer::NONE); 263 EXPECT_EQ(items & importer::PASSWORDS, importer::NONE);
264 EXPECT_EQ(items & importer::SEARCH_ENGINES, importer::NONE); 264 EXPECT_EQ(items & importer::SEARCH_ENGINES, importer::NONE);
265 EXPECT_EQ(items & importer::HOME_PAGE, importer::NONE); 265 EXPECT_EQ(items & importer::HOME_PAGE, importer::NONE);
266 266
267 // Check that we don't import anything from a bogus library directory. 267 // Check that we don't import anything from a bogus library directory.
268 base::ScopedTempDir fake_library_dir; 268 base::ScopedTempDir fake_library_dir;
269 ASSERT_TRUE(fake_library_dir.CreateUniqueTempDir()); 269 ASSERT_TRUE(fake_library_dir.CreateUniqueTempDir());
270 EXPECT_FALSE(SafariImporterCanImport(fake_library_dir.path(), &items)); 270 EXPECT_FALSE(SafariImporterCanImport(fake_library_dir.path(), &items));
271 } 271 }
OLDNEW
« no previous file with comments | « chrome/utility/importer/bookmarks_file_importer_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698