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

Unified Diff: chrome/browser/extensions/api/gcd_private/gcd_private_apitest.cc

Issue 411783002: Initial implementation of session APIs, sans WiFi component (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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/extensions/api/gcd_private/gcd_private_apitest.cc
diff --git a/chrome/browser/extensions/api/gcd_private/gcd_private_apitest.cc b/chrome/browser/extensions/api/gcd_private/gcd_private_apitest.cc
index bd502da2b7ed4336abd3b254b28d5f1595b3ffef..dc966dfe09b2c57a17b4d89acb2b59a3361b9223 100644
--- a/chrome/browser/extensions/api/gcd_private/gcd_private_apitest.cc
+++ b/chrome/browser/extensions/api/gcd_private/gcd_private_apitest.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/common/extensions/api/mdns.h"
#include "extensions/common/switches.h"
+#include "net/url_request/test_url_fetcher_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
#if defined(ENABLE_MDNS)
@@ -54,6 +55,16 @@ const char kGCDResponse[] =
" \"maxRole\": \"owner\""
" }}]}";
+const char kPrivetInfoResponse[] =
+ "{"
+ "\"x-privet-token\": \"sample\""
+ "}";
+
+const char kPrivetPingResponse[] =
+ "{"
+ "\"response\": \"pong\""
+ "}";
+
#if defined(ENABLE_MDNS)
const uint8 kAnnouncePacket[] = {
@@ -205,7 +216,7 @@ class FakeGCDApiFlowFactory
class GcdPrivateAPITest : public ExtensionApiTest {
public:
- GcdPrivateAPITest() {
+ GcdPrivateAPITest() : url_fetcher_factory_(NULL) {
#if defined(ENABLE_MDNS)
test_service_discovery_client_ =
new local_discovery::TestServiceDiscoveryClient();
@@ -215,6 +226,7 @@ class GcdPrivateAPITest : public ExtensionApiTest {
protected:
FakeGCDApiFlowFactory api_flow_factory_;
+ net::FakeURLFetcherFactory url_fetcher_factory_;
#if defined(ENABLE_MDNS)
scoped_refptr<local_discovery::TestServiceDiscoveryClient>
@@ -232,6 +244,20 @@ IN_PROC_BROWSER_TEST_F(GcdPrivateAPITest, GetCloudList) {
EXPECT_TRUE(RunExtensionSubtest("gcd_private/api", "get_cloud_list.html"));
}
+IN_PROC_BROWSER_TEST_F(GcdPrivateAPITest, Session) {
+ url_fetcher_factory_.SetFakeResponse(GURL("http://1.2.3.4:9090/privet/info"),
+ kPrivetInfoResponse,
+ net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
+
+ url_fetcher_factory_.SetFakeResponse(GURL("http://1.2.3.4:9090/privet/ping"),
+ kPrivetPingResponse,
+ net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
+
+ EXPECT_TRUE(RunExtensionSubtest("gcd_private/api", "session.html"));
+}
+
#if defined(ENABLE_MDNS)
IN_PROC_BROWSER_TEST_F(GcdPrivateAPITest, AddBefore) {

Powered by Google App Engine
This is Rietveld 408576698