| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 int tab_id = SessionTabHelper::IdForTab(web_contents); | 89 int tab_id = SessionTabHelper::IdForTab(web_contents); |
| 90 std::string debugee_by_tab = base::StringPrintf("{\"tabId\": %d}", tab_id); | 90 std::string debugee_by_tab = base::StringPrintf("{\"tabId\": %d}", tab_id); |
| 91 testing::AssertionResult result = | 91 testing::AssertionResult result = |
| 92 RunAttachFunctionOnTarget(debugee_by_tab, expected_error); | 92 RunAttachFunctionOnTarget(debugee_by_tab, expected_error); |
| 93 if (!result) | 93 if (!result) |
| 94 return result; | 94 return result; |
| 95 | 95 |
| 96 // Attach by targetId. | 96 // Attach by targetId. |
| 97 scoped_refptr<DebuggerGetTargetsFunction> get_targets_function = | 97 scoped_refptr<DebuggerGetTargetsFunction> get_targets_function = |
| 98 new DebuggerGetTargetsFunction(); | 98 new DebuggerGetTargetsFunction(); |
| 99 scoped_ptr<base::Value> value( | 99 std::unique_ptr<base::Value> value( |
| 100 extension_function_test_utils::RunFunctionAndReturnSingleResult( | 100 extension_function_test_utils::RunFunctionAndReturnSingleResult( |
| 101 get_targets_function.get(), "[]", browser())); | 101 get_targets_function.get(), "[]", browser())); |
| 102 base::ListValue* targets = nullptr; | 102 base::ListValue* targets = nullptr; |
| 103 EXPECT_TRUE(value->GetAsList(&targets)); | 103 EXPECT_TRUE(value->GetAsList(&targets)); |
| 104 | 104 |
| 105 std::string debugger_target_id; | 105 std::string debugger_target_id; |
| 106 for (size_t i = 0; i < targets->GetSize(); ++i) { | 106 for (size_t i = 0; i < targets->GetSize(); ++i) { |
| 107 base::DictionaryValue* target_dict = nullptr; | 107 base::DictionaryValue* target_dict = nullptr; |
| 108 EXPECT_TRUE(targets->GetDictionary(i, &target_dict)); | 108 EXPECT_TRUE(targets->GetDictionary(i, &target_dict)); |
| 109 int id = -1; | 109 int id = -1; |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 // Detach should remove the remaining infobar. | 299 // Detach should remove the remaining infobar. |
| 300 detach_function = new DebuggerDetachFunction(); | 300 detach_function = new DebuggerDetachFunction(); |
| 301 detach_function->set_extension(extension()); | 301 detach_function->set_extension(extension()); |
| 302 ASSERT_TRUE(RunFunction(detach_function.get(), | 302 ASSERT_TRUE(RunFunction(detach_function.get(), |
| 303 base::StringPrintf("[{\"tabId\": %d}]", tab_id), | 303 base::StringPrintf("[{\"tabId\": %d}]", tab_id), |
| 304 browser(), extension_function_test_utils::NONE)); | 304 browser(), extension_function_test_utils::NONE)); |
| 305 EXPECT_EQ(0u, service1->infobar_count()); | 305 EXPECT_EQ(0u, service1->infobar_count()); |
| 306 } | 306 } |
| 307 | 307 |
| 308 } // namespace extensions | 308 } // namespace extensions |
| OLD | NEW |