| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| 11 #include "base/thread_task_runner_handle.h" | 11 #include "base/thread_task_runner_handle.h" |
| 12 #include "chrome/browser/devtools/device/devtools_android_bridge.h" | 12 #include "chrome/browser/devtools/device/devtools_android_bridge.h" |
| 13 #include "chrome/browser/devtools/device/self_device_provider.h" | 13 #include "chrome/browser/devtools/device/tcp_device_provider.h" |
| 14 #include "chrome/browser/devtools/remote_debugging_server.h" | 14 #include "chrome/browser/devtools/remote_debugging_server.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
| 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 18 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
| 19 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
| 20 #include "chrome/test/base/in_process_browser_test.h" | 20 #include "chrome/test/base/in_process_browser_test.h" |
| 21 #include "chrome/test/base/ui_test_utils.h" | 21 #include "chrome/test/base/ui_test_utils.h" |
| 22 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
| 23 #include "content/public/test/browser_test_utils.h" | 23 #include "content/public/test/browser_test_utils.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 bool skip_empty_devices_; | 74 bool skip_empty_devices_; |
| 75 }; | 75 }; |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 // Flaky on all platforms. https://crbug.com/477696 | 78 // Flaky on all platforms. https://crbug.com/477696 |
| 79 IN_PROC_BROWSER_TEST_F(PortForwardingTest, | 79 IN_PROC_BROWSER_TEST_F(PortForwardingTest, |
| 80 DISABLED_LoadPageWithStyleAnsScript) { | 80 DISABLED_LoadPageWithStyleAnsScript) { |
| 81 Profile* profile = browser()->profile(); | 81 Profile* profile = browser()->profile(); |
| 82 | 82 |
| 83 AndroidDeviceManager::DeviceProviders device_providers; | 83 AndroidDeviceManager::DeviceProviders device_providers; |
| 84 device_providers.push_back(new SelfAsDeviceProvider(kDefaultDebuggingPort)); | 84 |
| 85 device_providers.push_back( |
| 86 TCPDeviceProvider::CreateForLocalhost(kDefaultDebuggingPort)); |
| 85 DevToolsAndroidBridge::Factory::GetForProfile(profile)-> | 87 DevToolsAndroidBridge::Factory::GetForProfile(profile)-> |
| 86 set_device_providers_for_test(device_providers); | 88 set_device_providers_for_test(device_providers); |
| 87 | 89 |
| 88 ASSERT_TRUE(test_server()->Start()); | 90 ASSERT_TRUE(test_server()->Start()); |
| 89 GURL original_url = test_server()->GetURL(kPortForwardingTestPage); | 91 GURL original_url = test_server()->GetURL(kPortForwardingTestPage); |
| 90 | 92 |
| 91 std::string forwarding_port("8000"); | 93 std::string forwarding_port("8000"); |
| 92 GURL forwarding_url(original_url.scheme() + "://" + | 94 GURL forwarding_url(original_url.scheme() + "://" + |
| 93 original_url.host() + ":" + forwarding_port + original_url.path()); | 95 original_url.host() + ":" + forwarding_port + original_url.path()); |
| 94 | 96 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 int GetRemoteDebuggingPort() override { | 144 int GetRemoteDebuggingPort() override { |
| 143 return kAlternativeDebuggingPort; | 145 return kAlternativeDebuggingPort; |
| 144 } | 146 } |
| 145 }; | 147 }; |
| 146 | 148 |
| 147 IN_PROC_BROWSER_TEST_F(PortForwardingDisconnectTest, DisconnectOnRelease) { | 149 IN_PROC_BROWSER_TEST_F(PortForwardingDisconnectTest, DisconnectOnRelease) { |
| 148 Profile* profile = browser()->profile(); | 150 Profile* profile = browser()->profile(); |
| 149 | 151 |
| 150 AndroidDeviceManager::DeviceProviders device_providers; | 152 AndroidDeviceManager::DeviceProviders device_providers; |
| 151 | 153 |
| 152 scoped_refptr<SelfAsDeviceProvider> self_provider( | 154 scoped_refptr<TCPDeviceProvider> self_provider( |
| 153 new SelfAsDeviceProvider(kAlternativeDebuggingPort)); | 155 TCPDeviceProvider::CreateForLocalhost(kAlternativeDebuggingPort)); |
| 154 device_providers.push_back(self_provider); | 156 device_providers.push_back(self_provider); |
| 155 | 157 |
| 156 DevToolsAndroidBridge::Factory::GetForProfile(profile)-> | 158 DevToolsAndroidBridge::Factory::GetForProfile(profile)-> |
| 157 set_device_providers_for_test(device_providers); | 159 set_device_providers_for_test(device_providers); |
| 158 | 160 |
| 159 ASSERT_TRUE(test_server()->Start()); | 161 ASSERT_TRUE(test_server()->Start()); |
| 160 GURL original_url = test_server()->GetURL(kPortForwardingTestPage); | 162 GURL original_url = test_server()->GetURL(kPortForwardingTestPage); |
| 161 | 163 |
| 162 std::string forwarding_port("8000"); | 164 std::string forwarding_port("8000"); |
| 163 GURL forwarding_url(original_url.scheme() + "://" + | 165 GURL forwarding_url(original_url.scheme() + "://" + |
| (...skipping 11 matching lines...) Expand all Loading... |
| 175 content::RunMessageLoop(); | 177 content::RunMessageLoop(); |
| 176 | 178 |
| 177 self_provider->set_release_callback_for_test( | 179 self_provider->set_release_callback_for_test( |
| 178 base::Bind(&base::MessageLoop::PostTask, | 180 base::Bind(&base::MessageLoop::PostTask, |
| 179 base::Unretained(base::MessageLoop::current()), | 181 base::Unretained(base::MessageLoop::current()), |
| 180 FROM_HERE, | 182 FROM_HERE, |
| 181 base::MessageLoop::QuitClosure())); | 183 base::MessageLoop::QuitClosure())); |
| 182 wait_for_port_forwarding.reset(); | 184 wait_for_port_forwarding.reset(); |
| 183 content::RunMessageLoop(); | 185 content::RunMessageLoop(); |
| 184 } | 186 } |
| OLD | NEW |