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

Unified Diff: chrome/browser/net/nqe/ui_network_quality_estimator_service_browsertest.cc

Issue 2103323007: Exposing NQE on the Browser UI thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mmenke comments Created 4 years, 5 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/net/nqe/ui_network_quality_estimator_service_browsertest.cc
diff --git a/chrome/browser/net/nqe/ui_network_quality_estimator_service_browsertest.cc b/chrome/browser/net/nqe/ui_network_quality_estimator_service_browsertest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..cc142f9d1c876ee68584de3fc76dd6941797fd88
--- /dev/null
+++ b/chrome/browser/net/nqe/ui_network_quality_estimator_service_browsertest.cc
@@ -0,0 +1,40 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/net/nqe/ui_network_quality_estimator_service.h"
+#include "chrome/browser/net/nqe/ui_network_quality_estimator_service_factory.h"
+#include "chrome/browser/net/nqe/ui_network_quality_estimator_service_test_util.h"
+#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/test/base/in_process_browser_test.h"
+#include "content/public/test/browser_test.h"
+#include "net/nqe/network_quality_estimator.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+class Profile;
+
+namespace {
+
+using UINetworkQualityEstimatorServiceBrowserTest = InProcessBrowserTest;
+
+} // namespace
+
+IN_PROC_BROWSER_TEST_F(UINetworkQualityEstimatorServiceBrowserTest,
+ VerifyNQEState) {
+ // Verifies that NQE notifying EffectiveConnectionTypeObservers causes the
+ // UINetworkQualityEstimatorService to receive an updated
+ // EffectiveConnectionType.
+ Profile* profile = ProfileManager::GetActiveUserProfile();
+ UINetworkQualityEstimatorService* nqe_service =
+ UINetworkQualityEstimatorServiceFactory::GetForProfile(profile);
+
+ nqe_test_util::OverrideEffectiveConnectionTypeAndWait(
+ net::NetworkQualityEstimator::EFFECTIVE_CONNECTION_TYPE_OFFLINE);
+ EXPECT_EQ(net::NetworkQualityEstimator::EFFECTIVE_CONNECTION_TYPE_OFFLINE,
+ nqe_service->GetEffectiveConnectionType());
+
+ nqe_test_util::OverrideEffectiveConnectionTypeAndWait(
+ net::NetworkQualityEstimator::EFFECTIVE_CONNECTION_TYPE_SLOW_2G);
+ EXPECT_EQ(net::NetworkQualityEstimator::EFFECTIVE_CONNECTION_TYPE_SLOW_2G,
+ nqe_service->GetEffectiveConnectionType());
+}

Powered by Google App Engine
This is Rietveld 408576698