| 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) {
|
|
|