-
Notifications
You must be signed in to change notification settings - Fork 887
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1345 from brave/sync-autosuggest-0.59.x
Autocomplete to chrome://sync and not chrome://sync-internals
- Loading branch information
Showing
5 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
browser/autocomplete/brave_autocomplete_provider_client_unittest.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "brave/browser/autocomplete/brave_autocomplete_provider_client.h" | ||
|
||
#include "base/strings/utf_string_conversions.h" | ||
#include "brave/common/webui_url_constants.h" | ||
#include "chrome/common/webui_url_constants.h" | ||
#include "chrome/test/base/testing_profile.h" | ||
#include "content/public/test/fake_service_worker_context.h" | ||
#include "content/public/test/test_browser_thread_bundle.h" | ||
#include "testing/gtest/include/gtest/gtest.h" | ||
|
||
class BraveAutocompleteProviderClientUnitTest : public testing::Test { | ||
public: | ||
void SetUp() override { | ||
profile_ = std::make_unique<TestingProfile>(); | ||
client_ = | ||
std::make_unique<BraveAutocompleteProviderClient>(profile_.get()); | ||
} | ||
|
||
bool BuiltinExists(const base::string16& builtin) { | ||
std::vector<base::string16> v = client_->GetBuiltinURLs(); | ||
auto it = std::find(v.begin(), v.end(), builtin); | ||
return it != v.end(); | ||
} | ||
|
||
protected: | ||
content::TestBrowserThreadBundle test_browser_thread_bundle_; | ||
std::unique_ptr<TestingProfile> profile_; | ||
std::unique_ptr<BraveAutocompleteProviderClient> client_; | ||
}; | ||
|
||
TEST_F(BraveAutocompleteProviderClientUnitTest, | ||
SyncURLSuggestedNotSyncInternal) { | ||
ASSERT_FALSE(BuiltinExists(base::ASCIIToUTF16(chrome::kChromeUISyncInternalsHost))); | ||
ASSERT_TRUE(BuiltinExists(base::ASCIIToUTF16(kBraveUISyncHost))); | ||
} |
10 changes: 10 additions & 0 deletions
10
chromium_src/chrome/browser/ui/omnibox/chrome_omnibox_client.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "brave/browser/autocomplete/brave_autocomplete_provider_client.h" | ||
|
||
#define ChromeAutocompleteProviderClient BraveAutocompleteProviderClient | ||
#include "../../../../../../chrome/browser/ui/omnibox/chrome_omnibox_client.cc" | ||
#undef ChromeAutocompleteProviderClient | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters