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

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

Issue 722723005: Move constants used by history component to history namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix android build failures Created 6 years 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/browser/history/history_backend.cc ('k') | chrome/browser/history/history_unittest.cc » ('j') | 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/browser/history/history_backend.h" 5 #include "chrome/browser/history/history_backend.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 13 matching lines...) Expand all
24 #include "chrome/browser/chrome_notification_types.h" 24 #include "chrome/browser/chrome_notification_types.h"
25 #include "chrome/browser/history/history_notifications.h" 25 #include "chrome/browser/history/history_notifications.h"
26 #include "chrome/browser/history/history_service.h" 26 #include "chrome/browser/history/history_service.h"
27 #include "chrome/browser/history/history_service_factory.h" 27 #include "chrome/browser/history/history_service_factory.h"
28 #include "chrome/browser/history/in_memory_history_backend.h" 28 #include "chrome/browser/history/in_memory_history_backend.h"
29 #include "chrome/browser/history/visit_filter.h" 29 #include "chrome/browser/history/visit_filter.h"
30 #include "chrome/common/chrome_constants.h" 30 #include "chrome/common/chrome_constants.h"
31 #include "chrome/common/chrome_paths.h" 31 #include "chrome/common/chrome_paths.h"
32 #include "chrome/common/importer/imported_favicon_usage.h" 32 #include "chrome/common/importer/imported_favicon_usage.h"
33 #include "chrome/test/base/testing_profile.h" 33 #include "chrome/test/base/testing_profile.h"
34 #include "components/history/core/browser/history_constants.h"
34 #include "components/history/core/browser/in_memory_database.h" 35 #include "components/history/core/browser/in_memory_database.h"
35 #include "components/history/core/browser/keyword_search_term.h" 36 #include "components/history/core/browser/keyword_search_term.h"
36 #include "components/history/core/test/history_client_fake_bookmarks.h" 37 #include "components/history/core/test/history_client_fake_bookmarks.h"
37 #include "content/public/browser/notification_details.h" 38 #include "content/public/browser/notification_details.h"
38 #include "content/public/browser/notification_source.h" 39 #include "content/public/browser/notification_source.h"
39 #include "content/public/test/test_browser_thread.h" 40 #include "content/public/test/test_browser_thread.h"
40 #include "testing/gmock/include/gmock/gmock.h" 41 #include "testing/gmock/include/gmock/gmock.h"
41 #include "testing/gtest/include/gtest/gtest.h" 42 #include "testing/gtest/include/gtest/gtest.h"
42 #include "third_party/skia/include/core/SkBitmap.h" 43 #include "third_party/skia/include/core/SkBitmap.h"
43 #include "ui/gfx/codec/png_codec.h" 44 #include "ui/gfx/codec/png_codec.h"
(...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after
1537 base::FilePath old_history_path; 1538 base::FilePath old_history_path;
1538 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &old_history_path)); 1539 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &old_history_path));
1539 old_history_path = old_history_path.AppendASCII("History"); 1540 old_history_path = old_history_path.AppendASCII("History");
1540 old_history_path = old_history_path.AppendASCII("HistoryNoSource"); 1541 old_history_path = old_history_path.AppendASCII("HistoryNoSource");
1541 1542
1542 // Copy history database file to current directory so that it will be deleted 1543 // Copy history database file to current directory so that it will be deleted
1543 // in Teardown. 1544 // in Teardown.
1544 base::FilePath new_history_path(test_dir()); 1545 base::FilePath new_history_path(test_dir());
1545 base::DeleteFile(new_history_path, true); 1546 base::DeleteFile(new_history_path, true);
1546 base::CreateDirectory(new_history_path); 1547 base::CreateDirectory(new_history_path);
1547 base::FilePath new_history_file = 1548 base::FilePath new_history_file = new_history_path.Append(kHistoryFilename);
1548 new_history_path.Append(chrome::kHistoryFilename);
1549 ASSERT_TRUE(base::CopyFile(old_history_path, new_history_file)); 1549 ASSERT_TRUE(base::CopyFile(old_history_path, new_history_file));
1550 1550
1551 backend_ = new HistoryBackend( 1551 backend_ = new HistoryBackend(
1552 new_history_path, new HistoryBackendTestDelegate(this), &history_client_); 1552 new_history_path, new HistoryBackendTestDelegate(this), &history_client_);
1553 backend_->Init(std::string(), false); 1553 backend_->Init(std::string(), false);
1554 backend_->Closing(); 1554 backend_->Closing();
1555 backend_ = NULL; 1555 backend_ = NULL;
1556 1556
1557 // Now the database should already be migrated. 1557 // Now the database should already be migrated.
1558 // Check version first. 1558 // Check version first.
(...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after
2790 base::FilePath old_history_path, old_history; 2790 base::FilePath old_history_path, old_history;
2791 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &old_history_path)); 2791 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &old_history_path));
2792 old_history_path = old_history_path.AppendASCII("History"); 2792 old_history_path = old_history_path.AppendASCII("History");
2793 old_history = old_history_path.AppendASCII("HistoryNoDuration"); 2793 old_history = old_history_path.AppendASCII("HistoryNoDuration");
2794 2794
2795 // Copy history database file to current directory so that it will be deleted 2795 // Copy history database file to current directory so that it will be deleted
2796 // in Teardown. 2796 // in Teardown.
2797 base::FilePath new_history_path(test_dir()); 2797 base::FilePath new_history_path(test_dir());
2798 base::DeleteFile(new_history_path, true); 2798 base::DeleteFile(new_history_path, true);
2799 base::CreateDirectory(new_history_path); 2799 base::CreateDirectory(new_history_path);
2800 base::FilePath new_history_file = 2800 base::FilePath new_history_file = new_history_path.Append(kHistoryFilename);
2801 new_history_path.Append(chrome::kHistoryFilename);
2802 ASSERT_TRUE(base::CopyFile(old_history, new_history_file)); 2801 ASSERT_TRUE(base::CopyFile(old_history, new_history_file));
2803 2802
2804 backend_ = new HistoryBackend( 2803 backend_ = new HistoryBackend(
2805 new_history_path, new HistoryBackendTestDelegate(this), &history_client_); 2804 new_history_path, new HistoryBackendTestDelegate(this), &history_client_);
2806 backend_->Init(std::string(), false); 2805 backend_->Init(std::string(), false);
2807 backend_->Closing(); 2806 backend_->Closing();
2808 backend_ = NULL; 2807 backend_ = NULL;
2809 2808
2810 // Now the history database should already be migrated. 2809 // Now the history database should already be migrated.
2811 2810
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
3274 // Verify that the second term is no longer returned as result, and also check 3273 // Verify that the second term is no longer returned as result, and also check
3275 // at the low level that it is gone for good. The term corresponding to the 3274 // at the low level that it is gone for good. The term corresponding to the
3276 // first URLRow should not be affected. 3275 // first URLRow should not be affected.
3277 EXPECT_EQ(1u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term1)); 3276 EXPECT_EQ(1u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term1));
3278 EXPECT_EQ(0u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term2)); 3277 EXPECT_EQ(0u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term2));
3279 EXPECT_TRUE(mem_backend_->db()->GetKeywordSearchTermRow(row1.id(), NULL)); 3278 EXPECT_TRUE(mem_backend_->db()->GetKeywordSearchTermRow(row1.id(), NULL));
3280 EXPECT_FALSE(mem_backend_->db()->GetKeywordSearchTermRow(row2.id(), NULL)); 3279 EXPECT_FALSE(mem_backend_->db()->GetKeywordSearchTermRow(row2.id(), NULL));
3281 } 3280 }
3282 3281
3283 } // namespace history 3282 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/history_backend.cc ('k') | chrome/browser/history/history_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698