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

Unified Diff: chrome/browser/autocomplete/in_memory_url_index_unittest.cc

Issue 1184923006: Revert of Abstract //content-level dependencies out of InMemoryURLIndex (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/autocomplete/in_memory_url_index_factory.cc ('k') | chrome/test/base/testing_profile.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autocomplete/in_memory_url_index_unittest.cc
diff --git a/chrome/browser/autocomplete/in_memory_url_index_unittest.cc b/chrome/browser/autocomplete/in_memory_url_index_unittest.cc
index 6c2c0e89911a2289a9a579f63ccd9e4455c822d3..401c5bf107662589af0f8fcfea05dcb21088384f 100644
--- a/chrome/browser/autocomplete/in_memory_url_index_unittest.cc
+++ b/chrome/browser/autocomplete/in_memory_url_index_unittest.cc
@@ -14,7 +14,6 @@
#include "base/run_loop.h"
#include "base/strings/string16.h"
#include "base/strings/string_util.h"
-#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/autocomplete/in_memory_url_index.h"
#include "chrome/browser/autocomplete/url_index_private_data.h"
@@ -28,7 +27,6 @@
#include "components/history/core/browser/history_database.h"
#include "components/history/core/browser/history_service.h"
#include "components/omnibox/in_memory_url_index_types.h"
-#include "content/public/browser/browser_thread.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "sql/transaction.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -50,7 +48,6 @@
const size_t kInvalid = base::string16::npos;
const size_t kMaxMatches = 3;
const char kTestLanguages[] = "en,ja,hi,zh";
-const char kClientWhitelistedScheme[] = "xyz";
// Helper function to set lower case |lower_string| and |lower_terms| (words
// list) based on supplied |search_string| and |cursor_position|. If
@@ -139,7 +136,7 @@
bool GetCacheFilePath(base::FilePath* file_path) const;
void PostRestoreFromCacheFileTask();
void PostSaveToCacheFileTask();
- const SchemeSet& scheme_whitelist();
+ const std::set<std::string>& scheme_whitelist();
// Pass-through functions to simplify our friendship with URLIndexPrivateData.
@@ -199,7 +196,7 @@
url_index_->PostSaveToCacheFileTask();
}
-const SchemeSet& InMemoryURLIndexTest::scheme_whitelist() {
+const std::set<std::string>& InMemoryURLIndexTest::scheme_whitelist() {
return url_index_->scheme_whitelist();
}
@@ -324,12 +321,8 @@
void InMemoryURLIndexTest::InitializeInMemoryURLIndex() {
DCHECK(!url_index_);
-
- SchemeSet client_schemes_to_whitelist;
- client_schemes_to_whitelist.insert(kClientWhitelistedScheme);
- url_index_.reset(new InMemoryURLIndex(
- nullptr, history_service_, content::BrowserThread::GetBlockingPool(),
- base::FilePath(), kTestLanguages, client_schemes_to_whitelist));
+ url_index_.reset(new InMemoryURLIndex(nullptr, history_service_,
+ base::FilePath(), kTestLanguages));
url_index_->Init();
url_index_->RebuildFromHistory(history_database_);
}
@@ -949,20 +942,18 @@
}
TEST_F(InMemoryURLIndexTest, WhitelistedURLs) {
- std::string client_whitelisted_url =
- base::StringPrintf("%s://foo", kClientWhitelistedScheme);
struct TestData {
const std::string url_spec;
const bool expected_is_whitelisted;
} data[] = {
// URLs with whitelisted schemes.
{ "about:histograms", true },
+ { "chrome://settings", true },
{ "file://localhost/Users/joeschmoe/sekrets", true },
{ "ftp://public.mycompany.com/myfile.txt", true },
{ "http://www.google.com/translate", true },
{ "https://www.gmail.com/", true },
{ "mailto:support@google.com", true },
- { client_whitelisted_url, true },
// URLs with unacceptable schemes.
{ "aaa://www.dummyhost.com;frammy", false },
{ "aaas://www.dummyhost.com;frammy", false },
@@ -1024,7 +1015,7 @@
{ "xmpp://guest@example.com", false },
};
- const SchemeSet& whitelist(scheme_whitelist());
+ const std::set<std::string>& whitelist(scheme_whitelist());
for (size_t i = 0; i < arraysize(data); ++i) {
GURL url(data[i].url_spec);
EXPECT_EQ(data[i].expected_is_whitelisted,
@@ -1323,9 +1314,8 @@
void InMemoryURLIndexCacheTest::SetUp() {
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
base::FilePath path(temp_dir_.path());
- url_index_.reset(new InMemoryURLIndex(
- nullptr, nullptr, content::BrowserThread::GetBlockingPool(), path,
- kTestLanguages, SchemeSet()));
+ url_index_.reset(
+ new InMemoryURLIndex(nullptr, nullptr, path, kTestLanguages));
}
void InMemoryURLIndexCacheTest::TearDown() {
« no previous file with comments | « chrome/browser/autocomplete/in_memory_url_index_factory.cc ('k') | chrome/test/base/testing_profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698