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

Unified Diff: chrome/browser/chromeos/tether/tether_service_unittest.cc

Issue 2913323003: Settings: Network: Merge Tether networks into Mobile subpage (Closed)
Patch Set: Fix browser_tests Created 3 years, 7 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/chromeos/tether/tether_service_unittest.cc
diff --git a/chrome/browser/chromeos/tether/tether_service_unittest.cc b/chrome/browser/chromeos/tether/tether_service_unittest.cc
index 2c5c8e69430d14b100cfde80efe53e65f95a09a0..8fc262b36be030e2e78e1c494b5b67f460ac4d17 100644
--- a/chrome/browser/chromeos/tether/tether_service_unittest.cc
+++ b/chrome/browser/chromeos/tether/tether_service_unittest.cc
@@ -9,6 +9,7 @@
#include "base/command_line.h"
#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h"
+#include "base/run_loop.h"
#include "base/test/scoped_task_environment.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_profile.h"
@@ -146,6 +147,7 @@ class TetherServiceTest : public chromeos::NetworkStateTest {
profile_.get(), fake_power_manager_client_.get(),
fake_session_manager_client_.get(), fake_cryptauth_service_.get(),
network_state_handler()));
+ base::RunLoop().RunUntilIdle();
}
void ShutdownTetherService() {
@@ -240,7 +242,8 @@ TEST_F(TetherServiceTest, TestFeatureFlagEnabled) {
chromeos::switches::kEnableTether);
TetherService* tether_service = TetherService::Get(profile_.get());
- EXPECT_TRUE(tether_service);
+ ASSERT_TRUE(tether_service);
+ base::RunLoop().RunUntilIdle();
tether_service->Shutdown();
}
@@ -307,18 +310,19 @@ TEST_F(TetherServiceTest, TestEnabled) {
// state than the user preference.
TEST_F(TetherServiceTest, TestEnabledMultipleChanges) {
CreateTetherService();
-
- EXPECT_EQ(0, tether_service_->updated_technology_state_count());
+ // CreateTetherService calls RunUntilIdle() so OnBluetoothAdapterFetched()
+ // will have been called which calls UpdateTetherTechnologyState().
+ EXPECT_EQ(1, tether_service_->updated_technology_state_count());
SetTetherTechnologyStateEnabled(false);
SetTetherTechnologyStateEnabled(false);
SetTetherTechnologyStateEnabled(false);
- EXPECT_EQ(1, tether_service_->updated_technology_state_count());
+ EXPECT_EQ(2, tether_service_->updated_technology_state_count());
SetTetherTechnologyStateEnabled(true);
SetTetherTechnologyStateEnabled(true);
SetTetherTechnologyStateEnabled(true);
- EXPECT_EQ(2, tether_service_->updated_technology_state_count());
+ EXPECT_EQ(3, tether_service_->updated_technology_state_count());
}
« no previous file with comments | « chrome/browser/chromeos/tether/tether_service.cc ('k') | chrome/browser/resources/chromeos/login/oobe_welcome.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698