summaryrefslogtreecommitdiff
path: root/chromium/chrome/renderer/media/cast_session_browsertest.cc
blob: 8c68f62f05e537cc926268b8d17f2f67c7d04d4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/renderer/media/cast_session.h"

#include "base/run_loop.h"
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/renderer/chrome_content_renderer_client.h"
#include "chrome/test/base/chrome_render_view_test.h"
#include "third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h"

typedef ChromeRenderViewTest CastSessionBrowserTest;

// Tests that CastSession is created and destroyed properly inside
// chrome renderer.
TEST_F(CastSessionBrowserTest, CreateAndDestroy) {
  chrome_render_thread_->set_io_task_runner(
      blink::scheduler::GetSingleThreadTaskRunnerForTesting());
  ChromeContentRendererClient* client =
      static_cast<ChromeContentRendererClient*>(content_renderer_client_.get());
  client->RenderThreadStarted();

  scoped_refptr<CastSession> session(
      new CastSession(blink::scheduler::GetSingleThreadTaskRunnerForTesting()));

  // Causes CastSession to destruct.
  session = NULL;
  base::RunLoop().RunUntilIdle();
}