Fixes up dependencies and namespaces for tests in //third_party/http2/adapter.
PiperOrigin-RevId: 365628212
Change-Id: I72a41e334c2dfac980f52c223abe7cd7432f13fb
diff --git a/http2/adapter/test_utils_test.cc b/http2/adapter/test_utils_test.cc
index a000e5c..e8f4ebd 100644
--- a/http2/adapter/test_utils_test.cc
+++ b/http2/adapter/test_utils_test.cc
@@ -1,6 +1,6 @@
#include "http2/adapter/test_utils.h"
-#include "testing/base/public/gunit.h"
+#include "common/platform/api/quiche_test.h"
#include "spdy/core/spdy_framer.h"
namespace http2 {
diff --git a/http2/adapter/window_manager.h b/http2/adapter/window_manager.h
index 3a25205..277c24f 100644
--- a/http2/adapter/window_manager.h
+++ b/http2/adapter/window_manager.h
@@ -6,6 +6,10 @@
namespace http2 {
namespace adapter {
+namespace test {
+class WindowManagerPeer;
+}
+
// This class keeps track of a HTTP/2 flow control window, notifying a listener
// when a window update needs to be sent. This class is not thread-safe.
class WindowManager {
@@ -44,7 +48,7 @@
}
private:
- friend class WindowManagerPeer;
+ friend class test::WindowManagerPeer;
void MaybeNotifyListener();
diff --git a/http2/adapter/window_manager_test.cc b/http2/adapter/window_manager_test.cc
index 4c589a7..549fd1c 100644
--- a/http2/adapter/window_manager_test.cc
+++ b/http2/adapter/window_manager_test.cc
@@ -2,16 +2,14 @@
#include <list>
-#include "testing/base/public/gmock.h"
-#include "testing/base/public/gunit.h"
#include "absl/functional/bind_front.h"
+#include "http2/test_tools/http2_random.h"
+#include "common/platform/api/quiche_test.h"
#include "spdy/platform/api/spdy_test_helpers.h"
-#include "util/random/acmrandom.h"
-
-using ::absl::bind_front;
namespace http2 {
namespace adapter {
+namespace test {
// Use the peer to access private vars of WindowManager.
class WindowManagerPeer {
@@ -26,12 +24,13 @@
const WindowManager& wm_;
};
+namespace {
+
class WindowManagerTest : public ::testing::Test {
protected:
WindowManagerTest()
- : wm_(kDefaultLimit, bind_front(&WindowManagerTest::OnCall, this)),
- peer_(wm_),
- random_(ACMRandom::HostnamePidTimeSeed()) {}
+ : wm_(kDefaultLimit, absl::bind_front(&WindowManagerTest::OnCall, this)),
+ peer_(wm_) {}
void OnCall(size_t s) {
call_sequence_.push_back(s);
@@ -41,7 +40,7 @@
std::list<size_t> call_sequence_;
WindowManager wm_;
WindowManagerPeer peer_;
- ACMRandom random_;
+ ::http2::test::Http2Random random_;
};
// A few no-op calls.
@@ -59,8 +58,7 @@
TEST_F(WindowManagerTest, DataOnlyBuffered) {
size_t total = 0;
while (total < kDefaultLimit) {
- size_t s = std::min<size_t>(kDefaultLimit - total,
- random_.UnbiasedUniform64(1024));
+ size_t s = std::min<size_t>(kDefaultLimit - total, random_.Uniform(1024));
total += s;
wm_.MarkDataBuffered(s);
}
@@ -73,13 +71,12 @@
size_t total_buffered = 0;
size_t total_flushed = 0;
while (call_sequence_.empty()) {
- size_t buffered = std::min<size_t>(kDefaultLimit - total_buffered,
- random_.UnbiasedUniform64(1024));
+ size_t buffered =
+ std::min<size_t>(kDefaultLimit - total_buffered, random_.Uniform(1024));
wm_.MarkDataBuffered(buffered);
total_buffered += buffered;
EXPECT_TRUE(call_sequence_.empty());
- size_t flushed =
- random_.UnbiasedUniform64(total_buffered - total_flushed);
+ size_t flushed = random_.Uniform(total_buffered - total_flushed);
wm_.MarkDataFlushed(flushed);
total_flushed += flushed;
}
@@ -168,5 +165,7 @@
EXPECT_THAT(call_sequence_, testing::ElementsAre(1));
}
+} // namespace
+} // namespace test
} // namespace adapter
} // namespace http2