| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 void DebuggerApiTest::SetUpCommandLine(base::CommandLine* command_line) { | 62 void DebuggerApiTest::SetUpCommandLine(base::CommandLine* command_line) { |
| 63 ExtensionApiTest::SetUpCommandLine(command_line); | 63 ExtensionApiTest::SetUpCommandLine(command_line); |
| 64 // We need to hold onto |command_line| in order to modify it during the test. | 64 // We need to hold onto |command_line| in order to modify it during the test. |
| 65 command_line_ = command_line; | 65 command_line_ = command_line; |
| 66 } | 66 } |
| 67 | 67 |
| 68 void DebuggerApiTest::SetUpOnMainThread() { | 68 void DebuggerApiTest::SetUpOnMainThread() { |
| 69 ExtensionApiTest::SetUpOnMainThread(); | 69 ExtensionApiTest::SetUpOnMainThread(); |
| 70 extension_ = ExtensionBuilder() | 70 extension_ = |
| 71 .SetManifest(std::move( | 71 ExtensionBuilder() |
| 72 DictionaryBuilder() | 72 .SetManifest( |
| 73 .Set("name", "debugger") | 73 DictionaryBuilder() |
| 74 .Set("version", "0.1") | 74 .Set("name", "debugger") |
| 75 .Set("manifest_version", 2) | 75 .Set("version", "0.1") |
| 76 .Set("permissions", | 76 .Set("manifest_version", 2) |
| 77 std::move(ListBuilder().Append("debugger"))))) | 77 .Set("permissions", ListBuilder().Append("debugger").Build()) |
| 78 .Build(); | 78 .Build()) |
| 79 .Build(); |
| 79 } | 80 } |
| 80 | 81 |
| 81 testing::AssertionResult DebuggerApiTest::RunAttachFunction( | 82 testing::AssertionResult DebuggerApiTest::RunAttachFunction( |
| 82 const GURL& url, const std::string& expected_error) { | 83 const GURL& url, const std::string& expected_error) { |
| 83 ui_test_utils::NavigateToURL(browser(), url); | 84 ui_test_utils::NavigateToURL(browser(), url); |
| 84 content::WebContents* web_contents = | 85 content::WebContents* web_contents = |
| 85 browser()->tab_strip_model()->GetActiveWebContents(); | 86 browser()->tab_strip_model()->GetActiveWebContents(); |
| 86 | 87 |
| 87 // Attach by tabId. | 88 // Attach by tabId. |
| 88 int tab_id = SessionTabHelper::IdForTab(web_contents); | 89 int tab_id = SessionTabHelper::IdForTab(web_contents); |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 // Detach should remove the remaining infobar. | 299 // Detach should remove the remaining infobar. |
| 299 detach_function = new DebuggerDetachFunction(); | 300 detach_function = new DebuggerDetachFunction(); |
| 300 detach_function->set_extension(extension()); | 301 detach_function->set_extension(extension()); |
| 301 ASSERT_TRUE(RunFunction(detach_function.get(), | 302 ASSERT_TRUE(RunFunction(detach_function.get(), |
| 302 base::StringPrintf("[{\"tabId\": %d}]", tab_id), | 303 base::StringPrintf("[{\"tabId\": %d}]", tab_id), |
| 303 browser(), extension_function_test_utils::NONE)); | 304 browser(), extension_function_test_utils::NONE)); |
| 304 EXPECT_EQ(0u, service1->infobar_count()); | 305 EXPECT_EQ(0u, service1->infobar_count()); |
| 305 } | 306 } |
| 306 | 307 |
| 307 } // namespace extensions | 308 } // namespace extensions |
| OLD | NEW |