Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / media / media_browsertest.h
blob5d3f222249c4495fb41ed452a076f40a50fd0295
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_MEDIA_MEDIA_BROWSERTEST_H_
6 #define CHROME_BROWSER_MEDIA_MEDIA_BROWSERTEST_H_
8 #include <string>
10 #include "chrome/test/base/in_process_browser_test.h"
11 #include "content/public/browser/web_contents_observer.h"
12 #include "media/base/test_data_util.h"
14 namespace content {
15 class TitleWatcher;
18 // Class used to automate running media related browser tests. The functions
19 // assume that media files are located under files/media/ folder known to
20 // the test http server.
21 class MediaBrowserTest : public InProcessBrowserTest,
22 public content::WebContentsObserver {
23 protected:
24 // Common test results.
25 static const char kEnded[];
26 // TODO(xhwang): Report detailed errors, e.g. "ERROR-3".
27 static const char kError[];
28 static const char kFailed[];
30 MediaBrowserTest();
31 ~MediaBrowserTest() override;
33 // Runs a html page with a list of URL query parameters.
34 // If http is true, the test starts a local http test server to load the test
35 // page, otherwise a local file URL is loaded inside the content shell.
36 // It uses RunTest() to check for expected test output.
37 void RunMediaTestPage(const std::string& html_page,
38 const base::StringPairs& query_params,
39 const std::string& expected,
40 bool http);
42 // Opens a URL and waits for the document title to match either one of the
43 // default strings or the expected string. Returns the matching title value.
44 std::string RunTest(const GURL& gurl, const std::string& expected);
46 virtual void AddWaitForTitles(content::TitleWatcher* title_watcher);
48 // Fails test and sets document title to kPluginCrashed when a plugin crashes.
49 // If IgnorePluginCrash(true) is called then plugin crash is ignored.
50 void PluginCrashed(const base::FilePath& plugin_path,
51 base::ProcessId plugin_pid) override;
53 // When called, the test will ignore any plugin crashes and not fail the test.
54 void IgnorePluginCrash();
56 private:
57 bool ignore_plugin_crash_;
60 #endif // CHROME_BROWSER_MEDIA_MEDIA_BROWSERTEST_H_