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

Unified Diff: chrome/browser/importer/ie_importer_browsertest_win.cc

Issue 800433002: Search for history items that was imported from IE is not working. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed some issues/comments found by Gab@ 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/utility/importer/ie_importer_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/importer/ie_importer_browsertest_win.cc
diff --git a/chrome/browser/importer/ie_importer_browsertest_win.cc b/chrome/browser/importer/ie_importer_browsertest_win.cc
index d41961481d398b59e5dc852c5ac4203c92dab4db..d3fd51946d135d6dcb9e029fb0ddecab6cae3279 100644
--- a/chrome/browser/importer/ie_importer_browsertest_win.cc
+++ b/chrome/browser/importer/ie_importer_browsertest_win.cc
@@ -85,6 +85,10 @@ const base::char16 kIEIdentifyUrl[] =
L"http://A79029D6-753E-4e27-B807-3D46AB1545DF.com:8080/path?key=value";
const base::char16 kIEIdentifyTitle[] =
L"Unittest GUID";
+const base::char16 kIECacheItemUrl[] =
+ L"http://B2EF40C8-2569-4D7E-97EA-BAD9DF468D9C.com";
+const base::char16 kIECacheItemTitle[] =
+ L"Unittest Cache Item GUID";
const base::char16 kFaviconStreamSuffix[] = L"url:favicon:$DATA";
const char kDummyFaviconImageData[] =
@@ -241,7 +245,7 @@ class TestObserver : public ProfileWriter,
EXPECT_EQ(arraysize(kIEFaviconGroup), favicon_count_);
}
if (importer_items_ & importer::HISTORY)
- EXPECT_EQ(1, history_count_);
+ EXPECT_EQ(2, history_count_);
if (importer_items_ & importer::HOME_PAGE)
EXPECT_EQ(1, homepage_count_);
if ((importer_items_ & importer::PASSWORDS) && (ie_version_ == IE7))
@@ -274,12 +278,25 @@ class TestObserver : public ProfileWriter,
virtual void AddHistoryPage(const history::URLRows& page,
history::VisitSource visit_source) {
+ bool cache_item_found = false;
+ bool history_item_found = false;
// Importer should read the specified URL.
for (size_t i = 0; i < page.size(); ++i) {
if (page[i].title() == kIEIdentifyTitle &&
- page[i].url() == GURL(kIEIdentifyUrl))
+ page[i].url() == GURL(kIEIdentifyUrl)) {
+ EXPECT_FALSE(page[i].hidden());
+ history_item_found = true;
++history_count_;
+ }
+ if (page[i].title() == kIECacheItemTitle &&
+ page[i].url() == GURL(kIECacheItemUrl)) {
+ EXPECT_TRUE(page[i].hidden());
+ cache_item_found = true;
+ ++history_count_;
+ }
}
+ EXPECT_TRUE(history_item_found);
+ EXPECT_TRUE(cache_item_found);
EXPECT_EQ(history::SOURCE_IE_IMPORTED, visit_source);
}
@@ -473,15 +490,17 @@ IN_PROC_BROWSER_TEST_F(IEImporterBrowserTest, IEImporter) {
std::vector<base::string16>(root_links,
root_links + arraysize(root_links))));
- HRESULT res;
-
// Sets up a special history link.
base::win::ScopedComPtr<IUrlHistoryStg2> url_history_stg2;
- res = url_history_stg2.CreateInstance(CLSID_CUrlHistory, NULL,
- CLSCTX_INPROC_SERVER);
- ASSERT_TRUE(res == S_OK);
- res = url_history_stg2->AddUrl(kIEIdentifyUrl, kIEIdentifyTitle, 0);
- ASSERT_TRUE(res == S_OK);
+ ASSERT_EQ(S_OK, url_history_stg2.CreateInstance(CLSID_CUrlHistory, NULL,
+ CLSCTX_INPROC_SERVER));
+ // Usage of ADDURL_ADDTOHISTORYANDCACHE and ADDURL_ADDTOCACHE flags
+ // is explained in the article:
+ // http://msdn.microsoft.com/ru-ru/aa767730
+ ASSERT_EQ(S_OK, url_history_stg2->AddUrl(kIEIdentifyUrl, kIEIdentifyTitle,
+ ADDURL_ADDTOHISTORYANDCACHE));
+ ASSERT_EQ(S_OK, url_history_stg2->AddUrl(kIECacheItemUrl, kIECacheItemTitle,
+ ADDURL_ADDTOCACHE));
// Starts to import the above settings.
// Deletes itself.
@@ -504,6 +523,7 @@ IN_PROC_BROWSER_TEST_F(IEImporterBrowserTest, IEImporter) {
// Cleans up.
url_history_stg2->DeleteUrl(kIEIdentifyUrl, 0);
+ url_history_stg2->DeleteUrl(kIECacheItemUrl, 0);
url_history_stg2.Release();
}
« no previous file with comments | « no previous file | chrome/utility/importer/ie_importer_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698