Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(345)

Side by Side Diff: chrome/browser/media/media_browsertest.h

Issue 357413002: Have media content and chrome browser tests load data from media/test/data (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix net dependency for media_perftests Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #ifndef CHROME_BROWSER_MEDIA_MEDIA_BROWSERTEST_H_ 5 #ifndef CHROME_BROWSER_MEDIA_MEDIA_BROWSERTEST_H_
6 #define CHROME_BROWSER_MEDIA_MEDIA_BROWSERTEST_H_ 6 #define CHROME_BROWSER_MEDIA_MEDIA_BROWSERTEST_H_
7 7
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
11 #include "chrome/test/base/in_process_browser_test.h" 11 #include "chrome/test/base/in_process_browser_test.h"
12 #include "content/public/browser/web_contents_observer.h" 12 #include "content/public/browser/web_contents_observer.h"
13 #include "media/base/test_data_util.h"
13 14
14 namespace content { 15 namespace content {
15 class TitleWatcher; 16 class TitleWatcher;
16 } 17 }
17 18
18 // Class used to automate running media related browser tests. The functions 19 // 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 // assume that media files are located under files/media/ folder known to
20 // the test http server. 21 // the test http server.
21 class MediaBrowserTest : public InProcessBrowserTest, 22 class MediaBrowserTest : public InProcessBrowserTest,
22 public content::WebContentsObserver { 23 public content::WebContentsObserver {
23 protected: 24 protected:
24 typedef std::pair<std::string, std::string> StringPair;
25
26 // Common test results. 25 // Common test results.
27 static const char kEnded[]; 26 static const char kEnded[];
28 // TODO(xhwang): Report detailed errors, e.g. "ERROR-3". 27 // TODO(xhwang): Report detailed errors, e.g. "ERROR-3".
29 static const char kError[]; 28 static const char kError[];
30 static const char kFailed[]; 29 static const char kFailed[];
31 static const char kPluginCrashed[]; 30 static const char kPluginCrashed[];
32 31
33 MediaBrowserTest(); 32 MediaBrowserTest();
34 virtual ~MediaBrowserTest(); 33 virtual ~MediaBrowserTest();
35 34
36 // Runs a html page with a list of URL query parameters. 35 // Runs a html page with a list of URL query parameters.
37 // If http is true, the test starts a local http test server to load the test 36 // If http is true, the test starts a local http test server to load the test
38 // page, otherwise a local file URL is loaded inside the content shell. 37 // page, otherwise a local file URL is loaded inside the content shell.
39 // It uses RunTest() to check for expected test output. 38 // It uses RunTest() to check for expected test output.
40 void RunMediaTestPage(const std::string& html_page, 39 void RunMediaTestPage(const std::string& html_page,
41 std::vector<StringPair>* query_params, 40 std::vector<media::StringPair>* query_params,
42 const std::string& expected, bool http); 41 const std::string& expected,
42 bool http);
43 43
44 // Opens a URL and waits for the document title to match either one of the 44 // Opens a URL and waits for the document title to match either one of the
45 // default strings or the expected string. 45 // default strings or the expected string.
46 base::string16 RunTest(const GURL& gurl, const std::string& expected); 46 std::string RunTest(const GURL& gurl, const std::string& expected);
xhwang 2014/07/07 17:39:54 Document about what the return value is.
shadi 2014/07/07 22:58:44 Done.
47 47
48 virtual void AddWaitForTitles(content::TitleWatcher* title_watcher); 48 virtual void AddWaitForTitles(content::TitleWatcher* title_watcher);
49 49
50 // Fails test and sets document title to kPluginCrashed when a plugin crashes. 50 // Fails test and sets document title to kPluginCrashed when a plugin crashes.
51 // If IgnorePluginCrash(true) is called then plugin crash is ignored. 51 // If IgnorePluginCrash(true) is called then plugin crash is ignored.
52 virtual void PluginCrashed(const base::FilePath& plugin_path, 52 virtual void PluginCrashed(const base::FilePath& plugin_path,
53 base::ProcessId plugin_pid) OVERRIDE; 53 base::ProcessId plugin_pid) OVERRIDE;
54 54
55 // When called, the test will ignore any plugin crashes and not fail the test. 55 // When called, the test will ignore any plugin crashes and not fail the test.
56 void IgnorePluginCrash(); 56 void IgnorePluginCrash();
57 57
58 private: 58 private:
59 bool ignore_plugin_crash_; 59 bool ignore_plugin_crash_;
60 }; 60 };
61 61
62 #endif // CHROME_BROWSER_MEDIA_MEDIA_BROWSERTEST_H_ 62 #endif // CHROME_BROWSER_MEDIA_MEDIA_BROWSERTEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698