From aafa710f1dc8a01159493f8b25b50ddcceac1169 Mon Sep 17 00:00:00 2001 From: boocmp Date: Thu, 12 May 2022 11:20:07 +0700 Subject: [PATCH] Fixing tests. --- browser/tor/brave_local_state_browsertest.cc | 2 +- browser/tor/brave_tor_browsertest.cc | 9 ++++++++- .../tor/brave_tor_pluggable_transport_updater.cc | 2 +- .../1.0.0/{tor-obsf4-brave => tor-obfs4-brave} | Bin 4 files changed, 10 insertions(+), 3 deletions(-) rename test/data/tor/components/win/hajklemofkhfcgodegbighbamaclcfgo/1.0.0/{tor-obsf4-brave => tor-obfs4-brave} (100%) diff --git a/browser/tor/brave_local_state_browsertest.cc b/browser/tor/brave_local_state_browsertest.cc index 2021a8c78f25..bf5d5473f332 100644 --- a/browser/tor/brave_local_state_browsertest.cc +++ b/browser/tor/brave_local_state_browsertest.cc @@ -22,7 +22,7 @@ IN_PROC_BROWSER_TEST_F(BraveLocalStateBrowserTest, BasicTest) { } IN_PROC_BROWSER_TEST_F(BraveLocalStateBrowserTest, ChangeTest) { - TorProfileServiceFactory::SetTorDisabled(false); + TorProfileServiceFactory::SetTorDisabled(true); EXPECT_TRUE(TorProfileServiceFactory::IsTorDisabled()); tor::BridgesConfig bridges_config; diff --git a/browser/tor/brave_tor_browsertest.cc b/browser/tor/brave_tor_browsertest.cc index 953235521cc0..94a01c1c42f9 100644 --- a/browser/tor/brave_tor_browsertest.cc +++ b/browser/tor/brave_tor_browsertest.cc @@ -169,6 +169,13 @@ class BraveTorTest : public InProcessBrowserTest { } } + void WaitProcessExit(int pid) { + base::Process p = base::Process::Open(pid); + if (p.IsValid()) { + p.WaitForExit(nullptr); + } + } + void WaitProcessExit(const std::string& name) { while (base::GetProcessCount(base::FilePath::FromASCII(name).value(), nullptr)) { @@ -194,7 +201,7 @@ IN_PROC_BROWSER_TEST_F(BraveTorTest, OpenCloseDisableTorWindow) { tor_browser, ui_test_utils::BrowserChangeObserver::ChangeType::kRemoved) .Wait(); - EXPECT_FALSE(base::Process::Open(tor.tor_pid).IsValid()); + WaitProcessExit(tor.tor_pid); } // Disable tor, expect executables are removed. diff --git a/components/tor/brave_tor_pluggable_transport_updater.cc b/components/tor/brave_tor_pluggable_transport_updater.cc index 41a07dc31f8f..ada2b71242ff 100644 --- a/components/tor/brave_tor_pluggable_transport_updater.cc +++ b/components/tor/brave_tor_pluggable_transport_updater.cc @@ -29,7 +29,7 @@ constexpr const char kComponentName[] = "Brave Pluggable Transports (Linux)"; #endif constexpr const char kSnowflakeExecutableName[] = "tor-snowflake-brave"; -constexpr const char kObfs4ExecutableName[] = "tor-obsf4-brave"; +constexpr const char kObfs4ExecutableName[] = "tor-obfs4-brave"; bool Initialize(const base::FilePath& install_dir) { const auto executables = {install_dir.AppendASCII(kSnowflakeExecutableName), diff --git a/test/data/tor/components/win/hajklemofkhfcgodegbighbamaclcfgo/1.0.0/tor-obsf4-brave b/test/data/tor/components/win/hajklemofkhfcgodegbighbamaclcfgo/1.0.0/tor-obfs4-brave similarity index 100% rename from test/data/tor/components/win/hajklemofkhfcgodegbighbamaclcfgo/1.0.0/tor-obsf4-brave rename to test/data/tor/components/win/hajklemofkhfcgodegbighbamaclcfgo/1.0.0/tor-obfs4-brave