| 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 "base/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
| 6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
| 7 #include "content/browser/browser_thread_impl.h" | 7 #include "content/browser/browser_thread_impl.h" |
| 8 #include "content/public/browser/devtools_agent_host.h" |
| 8 #include "content/public/browser/devtools_http_handler.h" | 9 #include "content/public/browser/devtools_http_handler.h" |
| 9 #include "content/public/browser/devtools_http_handler_delegate.h" | 10 #include "content/public/browser/devtools_http_handler_delegate.h" |
| 10 #include "net/socket/stream_listen_socket.h" | 11 #include "net/socket/stream_listen_socket.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 13 |
| 13 namespace content { | 14 namespace content { |
| 14 namespace { | 15 namespace { |
| 15 | 16 |
| 16 using net::StreamListenSocket; | 17 using net::StreamListenSocket; |
| 17 | 18 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 base::Closure quit_closure_2_; | 55 base::Closure quit_closure_2_; |
| 55 }; | 56 }; |
| 56 | 57 |
| 57 class DummyDelegate : public DevToolsHttpHandlerDelegate { | 58 class DummyDelegate : public DevToolsHttpHandlerDelegate { |
| 58 public: | 59 public: |
| 59 virtual std::string GetDiscoveryPageHTML() OVERRIDE { return std::string(); } | 60 virtual std::string GetDiscoveryPageHTML() OVERRIDE { return std::string(); } |
| 60 virtual bool BundlesFrontendResources() OVERRIDE { return true; } | 61 virtual bool BundlesFrontendResources() OVERRIDE { return true; } |
| 61 virtual base::FilePath GetDebugFrontendDir() OVERRIDE { | 62 virtual base::FilePath GetDebugFrontendDir() OVERRIDE { |
| 62 return base::FilePath(); | 63 return base::FilePath(); |
| 63 } | 64 } |
| 64 virtual std::string GetPageThumbnailData(const GURL& url) OVERRIDE { | 65 virtual bool SupportsPageThumbnails() OVERRIDE { return false; } |
| 66 virtual std::string GetPageThumbnailData(const std::string& id) OVERRIDE { |
| 65 return std::string(); | 67 return std::string(); |
| 66 } | 68 } |
| 67 virtual RenderViewHost* CreateNewTarget() OVERRIDE { return NULL; } | 69 virtual Target* CreateNewTarget() OVERRIDE { return NULL; } |
| 68 virtual TargetType GetTargetType(RenderViewHost*) OVERRIDE { | 70 virtual bool ActivateTarget(const std::string& id) OVERRIDE { return false; } |
| 69 return kTargetTypeTab; | 71 virtual bool CloseTarget(const std::string& id) OVERRIDE { return false; } |
| 72 |
| 73 virtual scoped_refptr<content::DevToolsAgentHost> GetAgentHost( |
| 74 const std::string& id) OVERRIDE { |
| 75 return NULL; |
| 70 } | 76 } |
| 71 virtual std::string GetViewDescription(content::RenderViewHost*) OVERRIDE { | 77 virtual void RequestTargets(TargetCallback callback) OVERRIDE {} |
| 72 return std::string(); | |
| 73 } | |
| 74 virtual scoped_ptr<net::StreamListenSocket> CreateSocketForTethering( | 78 virtual scoped_ptr<net::StreamListenSocket> CreateSocketForTethering( |
| 75 net::StreamListenSocket::Delegate* delegate, | 79 net::StreamListenSocket::Delegate* delegate, |
| 76 std::string* name) OVERRIDE { | 80 std::string* name) OVERRIDE { |
| 77 return scoped_ptr<net::StreamListenSocket>(); | 81 return scoped_ptr<net::StreamListenSocket>(); |
| 78 } | 82 } |
| 79 }; | 83 }; |
| 80 | 84 |
| 81 } | 85 } |
| 82 | 86 |
| 83 class DevToolsHttpHandlerTest : public testing::Test { | 87 class DevToolsHttpHandlerTest : public testing::Test { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 109 new DummyDelegate()); | 113 new DummyDelegate()); |
| 110 // Our dummy socket factory will post a quit message once the server will | 114 // Our dummy socket factory will post a quit message once the server will |
| 111 // become ready. | 115 // become ready. |
| 112 run_loop.Run(); | 116 run_loop.Run(); |
| 113 devtools_http_handler_->Stop(); | 117 devtools_http_handler_->Stop(); |
| 114 // Make sure the handler actually stops. | 118 // Make sure the handler actually stops. |
| 115 run_loop_2.Run(); | 119 run_loop_2.Run(); |
| 116 } | 120 } |
| 117 | 121 |
| 118 } // namespace content | 122 } // namespace content |
| OLD | NEW |