| OLD | NEW |
| 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/android/android_provider_backend.h" | 5 #include "chrome/browser/history/android/android_provider_backend.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| 11 #include "base/files/scoped_temp_dir.h" | 11 #include "base/files/scoped_temp_dir.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 15 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 16 #include "chrome/browser/chrome_notification_types.h" | 16 #include "chrome/browser/chrome_notification_types.h" |
| 17 #include "chrome/browser/history/android/android_time.h" | 17 #include "chrome/browser/history/android/android_time.h" |
| 18 #include "chrome/browser/history/chrome_history_client.h" | 18 #include "chrome/browser/history/chrome_history_client.h" |
| 19 #include "chrome/browser/history/chrome_history_client_factory.h" | 19 #include "chrome/browser/history/chrome_history_client_factory.h" |
| 20 #include "chrome/browser/history/history_backend.h" | 20 #include "chrome/browser/history/history_backend.h" |
| 21 #include "chrome/browser/profiles/profile_manager.h" | 21 #include "chrome/browser/profiles/profile_manager.h" |
| 22 #include "chrome/common/chrome_constants.h" | 22 #include "chrome/common/chrome_constants.h" |
| 23 #include "chrome/test/base/testing_browser_process.h" | 23 #include "chrome/test/base/testing_browser_process.h" |
| 24 #include "chrome/test/base/testing_profile.h" | 24 #include "chrome/test/base/testing_profile.h" |
| 25 #include "chrome/test/base/testing_profile_manager.h" | 25 #include "chrome/test/base/testing_profile_manager.h" |
| 26 #include "components/bookmarks/browser/bookmark_model.h" | 26 #include "components/bookmarks/browser/bookmark_model.h" |
| 27 #include "components/bookmarks/test/bookmark_test_helpers.h" | 27 #include "components/bookmarks/test/bookmark_test_helpers.h" |
| 28 #include "components/history/core/browser/history_constants.h" |
| 28 #include "components/history/core/browser/keyword_search_term.h" | 29 #include "components/history/core/browser/keyword_search_term.h" |
| 29 #include "content/public/browser/browser_thread.h" | 30 #include "content/public/browser/browser_thread.h" |
| 30 #include "content/public/test/test_browser_thread.h" | 31 #include "content/public/test/test_browser_thread.h" |
| 31 #include "content/public/test/test_utils.h" | 32 #include "content/public/test/test_utils.h" |
| 32 #include "testing/gtest/include/gtest/gtest.h" | 33 #include "testing/gtest/include/gtest/gtest.h" |
| 33 #include "third_party/skia/include/core/SkBitmap.h" | 34 #include "third_party/skia/include/core/SkBitmap.h" |
| 34 | 35 |
| 35 using base::Time; | 36 using base::Time; |
| 36 using base::TimeDelta; | 37 using base::TimeDelta; |
| 37 using base::UTF8ToUTF16; | 38 using base::UTF8ToUTF16; |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 ASSERT_TRUE(bookmark_model_); | 185 ASSERT_TRUE(bookmark_model_); |
| 185 | 186 |
| 186 // Get the BookmarkModel from LastUsedProfile, this is the same way that | 187 // Get the BookmarkModel from LastUsedProfile, this is the same way that |
| 187 // how the BookmarkModelSQLHandler gets the BookmarkModel. | 188 // how the BookmarkModelSQLHandler gets the BookmarkModel. |
| 188 Profile* profile = ProfileManager::GetLastUsedProfile(); | 189 Profile* profile = ProfileManager::GetLastUsedProfile(); |
| 189 ASSERT_TRUE(profile); | 190 ASSERT_TRUE(profile); |
| 190 | 191 |
| 191 // Setup the database directory and files. | 192 // Setup the database directory and files. |
| 192 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 193 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 193 | 194 |
| 194 history_db_name_ = temp_dir_.path().AppendASCII(chrome::kHistoryFilename); | 195 history_db_name_ = temp_dir_.path().AppendASCII(kHistoryFilename); |
| 195 thumbnail_db_name_ = temp_dir_.path().AppendASCII( | 196 thumbnail_db_name_ = temp_dir_.path().AppendASCII(kFaviconsFilename); |
| 196 chrome::kFaviconsFilename); | |
| 197 android_cache_db_name_ = temp_dir_.path().AppendASCII( | 197 android_cache_db_name_ = temp_dir_.path().AppendASCII( |
| 198 "TestAndroidCache.db"); | 198 "TestAndroidCache.db"); |
| 199 } | 199 } |
| 200 | 200 |
| 201 void AddBookmark(const GURL& url) { | 201 void AddBookmark(const GURL& url) { |
| 202 const BookmarkNode* mobile_node = bookmark_model_->mobile_node(); | 202 const BookmarkNode* mobile_node = bookmark_model_->mobile_node(); |
| 203 ASSERT_TRUE(mobile_node); | 203 ASSERT_TRUE(mobile_node); |
| 204 ASSERT_TRUE(bookmark_model_->AddURL(mobile_node, 0, base::string16(), url)); | 204 ASSERT_TRUE(bookmark_model_->AddURL(mobile_node, 0, base::string16(), url)); |
| 205 } | 205 } |
| 206 | 206 |
| (...skipping 1935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2142 update_args, &update_count)); | 2142 update_args, &update_count)); |
| 2143 // Verify notifications. | 2143 // Verify notifications. |
| 2144 EXPECT_FALSE(notifier_.deleted_details()); | 2144 EXPECT_FALSE(notifier_.deleted_details()); |
| 2145 ASSERT_TRUE(notifier_.modified_details()); | 2145 ASSERT_TRUE(notifier_.modified_details()); |
| 2146 ASSERT_EQ(1u, notifier_.modified_details()->size()); | 2146 ASSERT_EQ(1u, notifier_.modified_details()->size()); |
| 2147 // No favicon will be updated as thumbnail database is missing. | 2147 // No favicon will be updated as thumbnail database is missing. |
| 2148 EXPECT_FALSE(notifier_.favicon_changed()); | 2148 EXPECT_FALSE(notifier_.favicon_changed()); |
| 2149 } | 2149 } |
| 2150 | 2150 |
| 2151 } // namespace history | 2151 } // namespace history |
| OLD | NEW |