|
6 | 6 | #include "base/strings/utf_string_conversions.h"
|
7 | 7 | #include "brave/browser/profiles/profile_util.h"
|
8 | 8 | #include "brave/browser/tor/onion_location_tab_helper.h"
|
| 9 | +#include "brave/browser/tor/tor_profile_service.h" |
9 | 10 | #include "brave/browser/ui/browser_commands.h"
|
10 | 11 | #include "brave/browser/ui/views/brave_actions/brave_actions_container.h"
|
11 | 12 | #include "brave/browser/ui/views/location_bar/brave_location_bar_view.h"
|
@@ -165,3 +166,30 @@ IN_PROC_BROWSER_TEST_F(OnionLocationNavigationThrottleBrowserTest,
|
165 | 166 | browser_list->get(1)->tab_strip_model()->GetActiveWebContents();
|
166 | 167 | EXPECT_EQ(web_contents->GetURL(), GURL(kTestOnionURL));
|
167 | 168 | }
|
| 169 | + |
| 170 | +IN_PROC_BROWSER_TEST_F(OnionLocationNavigationThrottleBrowserTest, |
| 171 | + TorDisabled) { |
| 172 | + // Disable tor |
| 173 | + tor::TorProfileService::SetTorDisabled(true); |
| 174 | + |
| 175 | + // OnionLocationHeader_ |
| 176 | + GURL url = test_server()->GetURL("/onion"); |
| 177 | + ui_test_utils::NavigateToURL(browser(), url); |
| 178 | + content::WebContents* web_contents = |
| 179 | + browser()->tab_strip_model()->GetActiveWebContents(); |
| 180 | + tor::OnionLocationTabHelper* helper = |
| 181 | + tor::OnionLocationTabHelper::FromWebContents(web_contents); |
| 182 | + EXPECT_FALSE(helper->should_show_icon()); |
| 183 | + EXPECT_TRUE(helper->onion_location().is_empty()); |
| 184 | + |
| 185 | + // Onion Domain |
| 186 | + ui_test_utils::NavigateToURL(browser(), GURL(kTestOnionURL)); |
| 187 | + BrowserList* browser_list = BrowserList::GetInstance(); |
| 188 | + EXPECT_EQ(1U, browser_list->size()); |
| 189 | + |
| 190 | + // AutoOnionLocationPref |
| 191 | + browser()->profile()->GetPrefs()->SetBoolean(tor::prefs::kAutoOnionLocation, |
| 192 | + true); |
| 193 | + ui_test_utils::NavigateToURL(browser(), url); |
| 194 | + EXPECT_EQ(1U, browser_list->size()); |
| 195 | +} |
0 commit comments