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

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

Issue 1186103002: Abstract //content-level dependencies out of InMemoryURLIndex (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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
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 401c5bf107662589af0f8fcfea05dcb21088384f..54be09fa73cef4f4b478dab617bfb8f8f9107aa5 100644
--- a/chrome/browser/autocomplete/in_memory_url_index_unittest.cc
+++ b/chrome/browser/autocomplete/in_memory_url_index_unittest.cc
@@ -14,6 +14,7 @@
#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"
@@ -27,6 +28,7 @@
#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"
@@ -48,6 +50,7 @@ namespace {
const size_t kInvalid = base::string16::npos;
const size_t kMaxMatches = 3;
const char kTestLanguages[] = "en,ja,hi,zh";
+const char kClientWhitelistedScheme[] = "chrome";
Peter Kasting 2015/06/16 22:18:07 Nit: Let's use "xyz" here or something to make it
blundell 2015/06/17 07:55:44 Done.
// Helper function to set lower case |lower_string| and |lower_terms| (words
// list) based on supplied |search_string| and |cursor_position|. If
@@ -321,8 +324,12 @@ bool InMemoryURLIndexTest::InitializeInMemoryURLIndexInSetUp() const {
void InMemoryURLIndexTest::InitializeInMemoryURLIndex() {
DCHECK(!url_index_);
- url_index_.reset(new InMemoryURLIndex(nullptr, history_service_,
- base::FilePath(), kTestLanguages));
+
+ std::set<std::string> 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_->Init();
url_index_->RebuildFromHistory(history_database_);
}
@@ -942,18 +949,20 @@ TEST_F(InMemoryURLIndexTest, ExpireRow) {
}
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 },
@@ -1314,8 +1323,9 @@ class InMemoryURLIndexCacheTest : public testing::Test {
void InMemoryURLIndexCacheTest::SetUp() {
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
base::FilePath path(temp_dir_.path());
- url_index_.reset(
- new InMemoryURLIndex(nullptr, nullptr, path, kTestLanguages));
+ url_index_.reset(new InMemoryURLIndex(
+ nullptr, nullptr, content::BrowserThread::GetBlockingPool(), path,
+ kTestLanguages, std::set<std::string>()));
}
void InMemoryURLIndexCacheTest::TearDown() {

Powered by Google App Engine
This is Rietveld 408576698