| 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 "content/browser/renderer_host/media/media_stream_ui_proxy.h" | 5 #include "content/browser/renderer_host/media/media_stream_ui_proxy.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "content/browser/frame_host/render_frame_host_delegate.h" | 10 #include "content/browser/frame_host/render_frame_host_delegate.h" |
| 11 #include "content/public/test/test_browser_thread.h" | 11 #include "content/public/test/test_browser_thread.h" |
| 12 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "ui/gfx/geometry/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
| 15 #include "url/gurl.h" |
| 16 #include "url/origin.h" |
| 15 | 17 |
| 16 using testing::_; | 18 using testing::_; |
| 17 using testing::Return; | 19 using testing::Return; |
| 18 using testing::SaveArg; | 20 using testing::SaveArg; |
| 19 | 21 |
| 20 namespace content { | 22 namespace content { |
| 21 | 23 |
| 22 namespace { | 24 namespace { |
| 23 class MockRenderFrameHostDelegate : public RenderFrameHostDelegate { | 25 class MockRenderFrameHostDelegate : public RenderFrameHostDelegate { |
| 24 public: | 26 public: |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 EXPECT_CALL(handler, OnWindowId(kWindowId)); | 251 EXPECT_CALL(handler, OnWindowId(kWindowId)); |
| 250 | 252 |
| 251 proxy_->OnStarted( | 253 proxy_->OnStarted( |
| 252 base::Bind(&MockStopStreamHandler::OnStop, base::Unretained(&handler)), | 254 base::Bind(&MockStopStreamHandler::OnStop, base::Unretained(&handler)), |
| 253 base::Bind(&MockStopStreamHandler::OnWindowId, | 255 base::Bind(&MockStopStreamHandler::OnWindowId, |
| 254 base::Unretained(&handler))); | 256 base::Unretained(&handler))); |
| 255 message_loop_.RunUntilIdle(); | 257 message_loop_.RunUntilIdle(); |
| 256 } | 258 } |
| 257 | 259 |
| 258 TEST_F(MediaStreamUIProxyTest, CheckAccess) { | 260 TEST_F(MediaStreamUIProxyTest, CheckAccess) { |
| 259 proxy_->CheckAccess(GURL("http://origin/"), | 261 proxy_->CheckAccess(url::Origin(GURL("http://origin/")), |
| 260 MEDIA_DEVICE_AUDIO_CAPTURE, | 262 MEDIA_DEVICE_AUDIO_CAPTURE, 0, 0, |
| 261 0, | 263 base::Bind(&MockResponseCallback::OnCheckResponse, |
| 262 0, | 264 base::Unretained(&response_callback_))); |
| 263 base::Bind(&MockResponseCallback::OnCheckResponse, | |
| 264 base::Unretained(&response_callback_))); | |
| 265 EXPECT_CALL(delegate_, CheckMediaAccessPermission(_, _)); | 265 EXPECT_CALL(delegate_, CheckMediaAccessPermission(_, _)); |
| 266 EXPECT_CALL(response_callback_, OnCheckResponse(_)); | 266 EXPECT_CALL(response_callback_, OnCheckResponse(_)); |
| 267 message_loop_.RunUntilIdle(); | 267 message_loop_.RunUntilIdle(); |
| 268 } | 268 } |
| 269 | 269 |
| 270 } // content | 270 } // namespace content |
| OLD | NEW |