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

Side by Side Diff: headless/lib/headless_devtools_client_browsertest.cc

Issue 2812253002: Headless: Support sending and receiving of raw protocol messages (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <memory> 5 #include <memory>
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "content/public/browser/render_widget_host_view.h" 9 #include "content/public/browser/render_widget_host_view.h"
10 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 EXPECT_FALSE(test_handler_->last_http_request_headers().HasHeader( 980 EXPECT_FALSE(test_handler_->last_http_request_headers().HasHeader(
981 kDevToolsEmulateNetworkConditionsClientId)); 981 kDevToolsEmulateNetworkConditionsClientId));
982 FinishAsynchronousTest(); 982 FinishAsynchronousTest();
983 } 983 }
984 984
985 TestProtocolHandler* test_handler_; // NOT OWNED 985 TestProtocolHandler* test_handler_; // NOT OWNED
986 }; 986 };
987 987
988 HEADLESS_ASYNC_DEVTOOLED_TEST_F(DevToolsHeaderStrippingTest); 988 HEADLESS_ASYNC_DEVTOOLED_TEST_F(DevToolsHeaderStrippingTest);
989 989
990 class RawDevtoolsProtocolTest
991 : public HeadlessAsyncDevTooledBrowserTest,
992 public HeadlessDevToolsClient::RawProtocolListener {
993 public:
994 void RunDevTooledTest() override {
995 devtools_client_->SetRawProtocolListener(this);
996 devtools_client_->SendRawDevtoolsMessage(
997 R"({"id": 1, "method": "Runtime.evaluate",
998 "params": {"expression": "1+1"}})");
999 }
1000
1001 void OnProtocolMessage(const std::string& json_message,
1002 const base::DictionaryValue* parsed_message) override {
1003 EXPECT_EQ(
1004 "{\"id\":1,\"result\":{\"result\":{\"type\":\"number\","
1005 "\"value\":2,\"description\":\"2\"}}}",
1006 json_message);
1007 FinishAsynchronousTest();
1008 }
1009 };
1010
1011 HEADLESS_ASYNC_DEVTOOLED_TEST_F(RawDevtoolsProtocolTest);
1012
990 } // namespace headless 1013 } // namespace headless
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698