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

Side by Side Diff: chrome/browser/history/history_backend_unittest.cc

Issue 2714012: Convert page contents grabbing from wide to UTF16. The current code is a bit... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_path.h" 5 #include "base/file_path.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/ref_counted.h" 8 #include "base/ref_counted.h"
9 #include "base/scoped_ptr.h" 9 #include "base/scoped_ptr.h"
10 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/bookmarks/bookmark_model.h" 11 #include "chrome/browser/bookmarks/bookmark_model.h"
11 #include "chrome/browser/history/history_backend.h" 12 #include "chrome/browser/history/history_backend.h"
12 #include "chrome/browser/history/history_notifications.h" 13 #include "chrome/browser/history/history_notifications.h"
13 #include "chrome/browser/history/in_memory_history_backend.h" 14 #include "chrome/browser/history/in_memory_history_backend.h"
14 #include "chrome/browser/history/in_memory_database.h" 15 #include "chrome/browser/history/in_memory_database.h"
15 #include "chrome/common/notification_service.h" 16 #include "chrome/common/notification_service.h"
16 #include "chrome/common/thumbnail_score.h" 17 #include "chrome/common/thumbnail_score.h"
17 #include "chrome/tools/profiles/thumbnail-inl.h" 18 #include "chrome/tools/profiles/thumbnail-inl.h"
18 #include "gfx/codec/jpeg_codec.h" 19 #include "gfx/codec/jpeg_codec.h"
19 #include "googleurl/src/gurl.h" 20 #include "googleurl/src/gurl.h"
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 backend_->thumbnail_db_->SetPageThumbnail(gurl, row2_id, *weewar_bitmap, 243 backend_->thumbnail_db_->SetPageThumbnail(gurl, row2_id, *weewar_bitmap,
243 score, time); 244 score, time);
244 245
245 // Star row1. 246 // Star row1.
246 bookmark_model_.AddURL( 247 bookmark_model_.AddURL(
247 bookmark_model_.GetBookmarkBarNode(), 0, std::wstring(), row1.url()); 248 bookmark_model_.GetBookmarkBarNode(), 0, std::wstring(), row1.url());
248 249
249 // Set full text index for each one. 250 // Set full text index for each one.
250 backend_->text_database_->AddPageData(row1.url(), row1_id, visit1_id, 251 backend_->text_database_->AddPageData(row1.url(), row1_id, visit1_id,
251 row1.last_visit(), 252 row1.last_visit(),
252 L"Title 1", L"Body 1"); 253 L"Title 1", UTF8ToUTF16("Body 1"));
253 backend_->text_database_->AddPageData(row2.url(), row2_id, visit2_id, 254 backend_->text_database_->AddPageData(row2.url(), row2_id, visit2_id,
254 row2.last_visit(), 255 row2.last_visit(),
255 L"Title 2", L"Body 2"); 256 L"Title 2", UTF8ToUTF16("Body 2"));
256 257
257 // Now finally clear all history. 258 // Now finally clear all history.
258 backend_->DeleteAllHistory(); 259 backend_->DeleteAllHistory();
259 260
260 // The first URL should be preserved but the time should be cleared. 261 // The first URL should be preserved but the time should be cleared.
261 EXPECT_TRUE(backend_->db_->GetRowForURL(row1.url(), &outrow1)); 262 EXPECT_TRUE(backend_->db_->GetRowForURL(row1.url(), &outrow1));
262 EXPECT_EQ(0, outrow1.visit_count()); 263 EXPECT_EQ(0, outrow1.visit_count());
263 EXPECT_EQ(0, outrow1.typed_count()); 264 EXPECT_EQ(0, outrow1.typed_count());
264 EXPECT_TRUE(Time() == outrow1.last_visit()); 265 EXPECT_TRUE(Time() == outrow1.last_visit());
265 266
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 // Fetch the row information about stripped url from history db. 583 // Fetch the row information about stripped url from history db.
583 VisitVector visits; 584 VisitVector visits;
584 URLID row_id = backend_->db_->GetRowForURL(stripped_url, NULL); 585 URLID row_id = backend_->db_->GetRowForURL(stripped_url, NULL);
585 backend_->db_->GetVisitsForURL(row_id, &visits); 586 backend_->db_->GetVisitsForURL(row_id, &visits);
586 587
587 // Check if stripped url is stored in database. 588 // Check if stripped url is stored in database.
588 ASSERT_EQ(1U, visits.size()); 589 ASSERT_EQ(1U, visits.size());
589 } 590 }
590 591
591 } // namespace history 592 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698