1868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved.
2868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
3868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// found in the LICENSE file.
4868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
5d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)#ifndef CONTENT_BROWSER_MEDIA_MEDIA_BROWSERTEST_H_
6d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)#define CONTENT_BROWSER_MEDIA_MEDIA_BROWSERTEST_H_
7d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
85f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#include <string>
9d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
10effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch#include "content/public/test/content_browser_test.h"
115f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#include "media/base/test_data_util.h"
12868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
13868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)namespace content {
14868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
15d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)class TitleWatcher;
16d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
17868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Class used to automate running media related browser tests. The functions
18868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// assume that media files are located under files/media/ folder known to
19868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// the test http server.
20868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)class MediaBrowserTest : public ContentBrowserTest {
21868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) public:
22d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // Common test results.
23868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  static const char kEnded[];
24868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  static const char kError[];
25868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  static const char kFailed[];
26868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
27868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // Runs a html page with a list of URL query parameters.
28868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // If http is true, the test starts a local http test server to load the test
29868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // page, otherwise a local file URL is loaded inside the content shell.
30868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // It uses RunTest() to check for expected test output.
315f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  void RunMediaTestPage(const std::string& html_page,
325f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)                        const media::QueryParams& query_params,
335f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)                        const std::string& expected,
345f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)                        bool http);
35868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
36868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // Opens a URL and waits for the document title to match either one of the
375f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  // default strings or the expected string. Returns the matching title value.
385f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  std::string RunTest(const GURL& gurl, const std::string& expected);
39d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
40d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  virtual void AddWaitForTitles(content::TitleWatcher* title_watcher);
41868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)};
42868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
435f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)}  // namespace content
44d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
45d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)#endif  // CONTENT_BROWSER_MEDIA_MEDIA_BROWSERTEST_H_
46