OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stddef.h> | 5 #include <stddef.h> |
6 #include <utility> | 6 #include <utility> |
7 | 7 |
8 #include "base/base64.h" | 8 #include "base/base64.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 WaitForNotification("Page.javascriptDialogOpening"); | 937 WaitForNotification("Page.javascriptDialogOpening"); |
938 dialog_manager.Handle(); | 938 dialog_manager.Handle(); |
939 } | 939 } |
940 | 940 |
941 IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, BrowserCreateAndCloseTarget) { | 941 IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, BrowserCreateAndCloseTarget) { |
942 NavigateToURLBlockUntilNavigationsComplete(shell(), GURL("about:blank"), 1); | 942 NavigateToURLBlockUntilNavigationsComplete(shell(), GURL("about:blank"), 1); |
943 Attach(); | 943 Attach(); |
944 EXPECT_EQ(1u, shell()->windows().size()); | 944 EXPECT_EQ(1u, shell()->windows().size()); |
945 std::unique_ptr<base::DictionaryValue> params(new base::DictionaryValue()); | 945 std::unique_ptr<base::DictionaryValue> params(new base::DictionaryValue()); |
946 params->SetString("url", "about:blank"); | 946 params->SetString("url", "about:blank"); |
947 SendCommand("Browser.createTarget", std::move(params), true); | 947 SendCommand("Target.createTarget", std::move(params), true); |
948 std::string target_id; | 948 std::string target_id; |
949 EXPECT_TRUE(result_->GetString("targetId", &target_id)); | 949 EXPECT_TRUE(result_->GetString("targetId", &target_id)); |
950 EXPECT_EQ(2u, shell()->windows().size()); | 950 EXPECT_EQ(2u, shell()->windows().size()); |
951 | 951 |
952 // TODO(eseckler): Since the RenderView is closed asynchronously, we currently | 952 // TODO(eseckler): Since the RenderView is closed asynchronously, we currently |
953 // don't verify that the command actually closes the shell. | 953 // don't verify that the command actually closes the shell. |
954 bool success; | 954 bool success; |
955 params.reset(new base::DictionaryValue()); | 955 params.reset(new base::DictionaryValue()); |
956 params->SetString("targetId", target_id); | 956 params->SetString("targetId", target_id); |
957 SendCommand("Browser.closeTarget", std::move(params), true); | 957 SendCommand("Target.closeTarget", std::move(params), true); |
958 EXPECT_TRUE(result_->GetBoolean("success", &success)); | 958 EXPECT_TRUE(result_->GetBoolean("success", &success)); |
959 EXPECT_TRUE(success); | 959 EXPECT_TRUE(success); |
960 } | 960 } |
961 | 961 |
962 IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, BrowserGetTargets) { | 962 IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, BrowserGetTargets) { |
963 NavigateToURLBlockUntilNavigationsComplete(shell(), GURL("about:blank"), 1); | 963 NavigateToURLBlockUntilNavigationsComplete(shell(), GURL("about:blank"), 1); |
964 Attach(); | 964 Attach(); |
965 SendCommand("Browser.getTargets", nullptr, true); | 965 SendCommand("Target.getTargets", nullptr, true); |
966 base::ListValue* target_infos; | 966 base::ListValue* target_infos; |
967 EXPECT_TRUE(result_->GetList("targetInfo", &target_infos)); | 967 EXPECT_TRUE(result_->GetList("targetInfos", &target_infos)); |
968 EXPECT_EQ(1u, target_infos->GetSize()); | 968 EXPECT_EQ(1u, target_infos->GetSize()); |
969 base::DictionaryValue* target_info; | 969 base::DictionaryValue* target_info; |
970 EXPECT_TRUE(target_infos->GetDictionary(0u, &target_info)); | 970 EXPECT_TRUE(target_infos->GetDictionary(0u, &target_info)); |
971 std::string target_id, type, title, url; | 971 std::string target_id, type, title, url; |
972 EXPECT_TRUE(target_info->GetString("targetId", &target_id)); | 972 EXPECT_TRUE(target_info->GetString("targetId", &target_id)); |
973 EXPECT_TRUE(target_info->GetString("type", &type)); | 973 EXPECT_TRUE(target_info->GetString("type", &type)); |
974 EXPECT_TRUE(target_info->GetString("title", &title)); | 974 EXPECT_TRUE(target_info->GetString("title", &title)); |
975 EXPECT_TRUE(target_info->GetString("url", &url)); | 975 EXPECT_TRUE(target_info->GetString("url", &url)); |
976 EXPECT_EQ(type, "page"); | 976 EXPECT_EQ(type, "page"); |
977 EXPECT_EQ(title, "about:blank"); | 977 EXPECT_EQ(title, "about:blank"); |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1395 command_params.reset(new base::DictionaryValue()); | 1395 command_params.reset(new base::DictionaryValue()); |
1396 command_params->SetBoolean("autoAttach", false); | 1396 command_params->SetBoolean("autoAttach", false); |
1397 command_params->SetBoolean("waitForDebuggerOnStart", false); | 1397 command_params->SetBoolean("waitForDebuggerOnStart", false); |
1398 SendCommand("Target.setAutoAttach", std::move(command_params), false); | 1398 SendCommand("Target.setAutoAttach", std::move(command_params), false); |
1399 params = WaitForNotification("Target.detachedFromTarget", true); | 1399 params = WaitForNotification("Target.detachedFromTarget", true); |
1400 EXPECT_TRUE(params->GetString("targetId", &temp)); | 1400 EXPECT_TRUE(params->GetString("targetId", &temp)); |
1401 EXPECT_EQ(target_id, temp); | 1401 EXPECT_EQ(target_id, temp); |
1402 } | 1402 } |
1403 | 1403 |
1404 } // namespace content | 1404 } // namespace content |
OLD | NEW |