| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/test/chromedriver/chrome/devtools_client_impl.h" | 5 #include "chrome/test/chromedriver/chrome/devtools_client_impl.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 } | 512 } |
| 513 | 513 |
| 514 TEST(ParseInspectorMessage, EventNoParams) { | 514 TEST(ParseInspectorMessage, EventNoParams) { |
| 515 internal::InspectorMessageType type; | 515 internal::InspectorMessageType type; |
| 516 internal::InspectorEvent event; | 516 internal::InspectorEvent event; |
| 517 internal::InspectorCommandResponse response; | 517 internal::InspectorCommandResponse response; |
| 518 ASSERT_TRUE(internal::ParseInspectorMessage( | 518 ASSERT_TRUE(internal::ParseInspectorMessage( |
| 519 "{\"method\":\"method\"}", 0, &type, &event, &response)); | 519 "{\"method\":\"method\"}", 0, &type, &event, &response)); |
| 520 ASSERT_EQ(internal::kEventMessageType, type); | 520 ASSERT_EQ(internal::kEventMessageType, type); |
| 521 ASSERT_STREQ("method", event.method.c_str()); | 521 ASSERT_STREQ("method", event.method.c_str()); |
| 522 ASSERT_TRUE(event.params->IsType(base::Value::TYPE_DICTIONARY)); | 522 ASSERT_TRUE(event.params->IsType(base::Value::Type::DICTIONARY)); |
| 523 } | 523 } |
| 524 | 524 |
| 525 TEST(ParseInspectorMessage, EventWithParams) { | 525 TEST(ParseInspectorMessage, EventWithParams) { |
| 526 internal::InspectorMessageType type; | 526 internal::InspectorMessageType type; |
| 527 internal::InspectorEvent event; | 527 internal::InspectorEvent event; |
| 528 internal::InspectorCommandResponse response; | 528 internal::InspectorCommandResponse response; |
| 529 ASSERT_TRUE(internal::ParseInspectorMessage( | 529 ASSERT_TRUE(internal::ParseInspectorMessage( |
| 530 "{\"method\":\"method\",\"params\":{\"key\":100}}", | 530 "{\"method\":\"method\",\"params\":{\"key\":100}}", |
| 531 0, &type, &event, &response)); | 531 0, &type, &event, &response)); |
| 532 ASSERT_EQ(internal::kEventMessageType, type); | 532 ASSERT_EQ(internal::kEventMessageType, type); |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1168 SyncWebSocketFactory factory = | 1168 SyncWebSocketFactory factory = |
| 1169 base::Bind(&CreateMockSyncWebSocket<MockSyncWebSocket7>); | 1169 base::Bind(&CreateMockSyncWebSocket<MockSyncWebSocket7>); |
| 1170 DevToolsClientImpl client(factory, "http://url", "id", | 1170 DevToolsClientImpl client(factory, "http://url", "id", |
| 1171 base::Bind(&CloserFunc)); | 1171 base::Bind(&CloserFunc)); |
| 1172 ASSERT_EQ(kOk, client.ConnectIfNecessary().code()); | 1172 ASSERT_EQ(kOk, client.ConnectIfNecessary().code()); |
| 1173 base::DictionaryValue params; | 1173 base::DictionaryValue params; |
| 1174 params.SetInteger("param", 1); | 1174 params.SetInteger("param", 1); |
| 1175 ASSERT_EQ(kOk, client.SendCommandAndIgnoreResponse("method", params).code()); | 1175 ASSERT_EQ(kOk, client.SendCommandAndIgnoreResponse("method", params).code()); |
| 1176 ASSERT_EQ(kOk, client.SendCommand("method", params).code()); | 1176 ASSERT_EQ(kOk, client.SendCommand("method", params).code()); |
| 1177 } | 1177 } |
| OLD | NEW |