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

Side by Side Diff: chrome/browser/webdata/keyword_table_unittest.cc

Issue 7980028: Ensure that TemplateURLs created from old database entries without sync_guids generate their own ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/webdata/keyword_table.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/file_util.h" 5 #include "base/file_util.h"
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "base/string_number_conversions.h" 7 #include "base/string_number_conversions.h"
8 #include "base/time.h" 8 #include "base/time.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/common/chrome_paths.h" 10 #include "chrome/common/chrome_paths.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 EXPECT_EQ(1U, template_urls.size()); 245 EXPECT_EQ(1U, template_urls.size());
246 const TemplateURL* restored_url = template_urls.front(); 246 const TemplateURL* restored_url = template_urls.front();
247 247
248 EXPECT_EQ(template_url.short_name(), restored_url->short_name()); 248 EXPECT_EQ(template_url.short_name(), restored_url->short_name());
249 EXPECT_EQ(template_url.keyword(), restored_url->keyword()); 249 EXPECT_EQ(template_url.keyword(), restored_url->keyword());
250 EXPECT_TRUE(!restored_url->GetFaviconURL().is_valid()); 250 EXPECT_TRUE(!restored_url->GetFaviconURL().is_valid());
251 EXPECT_TRUE(restored_url->safe_for_autoreplace()); 251 EXPECT_TRUE(restored_url->safe_for_autoreplace());
252 EXPECT_EQ(GetID(&template_url), GetID(restored_url)); 252 EXPECT_EQ(GetID(&template_url), GetID(restored_url));
253 delete restored_url; 253 delete restored_url;
254 } 254 }
255
256 TEST_F(KeywordTableTest, KeywordWithEmptySyncGUID) {
257 WebDatabase db;
258
259 ASSERT_EQ(sql::INIT_OK, db.Init(file_));
260
261 TemplateURL template_url;
262 template_url.set_short_name(ASCIIToUTF16("short_name"));
263 template_url.set_keyword(ASCIIToUTF16("keyword"));
264 template_url.SetURL("http://url/", 0, 0);
265 template_url.set_safe_for_autoreplace(true);
266 SetID(-100, &template_url);
267
268 // A GUID should be generated when |template_url| was created. Clear it.
269 ASSERT_FALSE(template_url.sync_guid().empty());
270 template_url.set_sync_guid(std::string());
271
272 EXPECT_TRUE(db.GetKeywordTable()->AddKeyword(template_url));
273
274 std::vector<TemplateURL*> template_urls;
275 EXPECT_TRUE(db.GetKeywordTable()->GetKeywords(&template_urls));
276 EXPECT_EQ(1U, template_urls.size());
277 const TemplateURL* restored_url = template_urls.front();
278
279 EXPECT_EQ(template_url.short_name(), restored_url->short_name());
280 EXPECT_EQ(template_url.keyword(), restored_url->keyword());
281 EXPECT_EQ(GetID(&template_url), GetID(restored_url));
282 EXPECT_FALSE(restored_url->sync_guid().empty());
283 delete restored_url;
284 }
OLDNEW
« no previous file with comments | « chrome/browser/webdata/keyword_table.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698