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

Unified Diff: components/offline_pages/background/request_coordinator_unittest.cc

Issue 1950733002: Add unit test for request coordiator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More CR feedback per FGorski Created 4 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
« no previous file with comments | « components/offline_pages/background/request_coordinator.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/offline_pages/background/request_coordinator_unittest.cc
diff --git a/components/offline_pages/background/request_coordinator_unittest.cc b/components/offline_pages/background/request_coordinator_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c0388ce6c766dbde775291fec5996e51e138b421
--- /dev/null
+++ b/components/offline_pages/background/request_coordinator_unittest.cc
@@ -0,0 +1,50 @@
+// 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 "components/offline_pages/background/request_coordinator.h"
+
+#include "base/bind.h"
+#include "base/memory/weak_ptr.h"
fgorski 2016/05/04 18:20:16 nit: not needed
+#include "components/offline_pages/background/save_page_request.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace offline_pages {
+
+namespace {
+// put test constants here
+const int64_t kRequestId = 42;
+const GURL kUrl("http://universe.com/everything");
+const ClientId kClientId("bookmark", "1234");
+} // namespace
+
+class RequestCoordinatorTest
+ : public testing::Test {
+ public:
+ RequestCoordinatorTest();
+ ~RequestCoordinatorTest() override;
+
+ void CallbackFunction() {
+ }
+};
+
+RequestCoordinatorTest::RequestCoordinatorTest() {}
+
+RequestCoordinatorTest::~RequestCoordinatorTest() {}
+
+TEST_F(RequestCoordinatorTest, StartProcessingWithNoRequests) {
+ RequestCoordinator::ProcessingDoneCallback callback =
+ base::Bind(
+ &RequestCoordinatorTest::CallbackFunction,
+ base::Unretained(this));
+ RequestCoordinator coordinator;
+ EXPECT_FALSE(coordinator.StartProcessing(callback));
+}
+
+TEST_F(RequestCoordinatorTest, SavePageLater) {
+ RequestCoordinator coordinator;
+ SavePageRequest request(kRequestId, kUrl, kClientId, base::Time::Now());
+ EXPECT_TRUE(coordinator.SavePageLater(request));
+}
+
+} // namespace offline_pages
« no previous file with comments | « components/offline_pages/background/request_coordinator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698