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

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

Issue 206693004: Update media browser tests to observe plugin crashes! (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 6 years, 9 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
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 13
13 namespace content { 14 namespace content {
14 class TitleWatcher; 15 class TitleWatcher;
15 } 16 }
16 17
17 // Class used to automate running media related browser tests. The functions 18 // Class used to automate running media related browser tests. The functions
18 // assume that media files are located under files/media/ folder known to 19 // assume that media files are located under files/media/ folder known to
19 // the test http server. 20 // the test http server.
20 class MediaBrowserTest : public InProcessBrowserTest { 21 class MediaBrowserTest : public InProcessBrowserTest,
22 public content::WebContentsObserver {
21 protected: 23 protected:
22 typedef std::pair<std::string, std::string> StringPair; 24 typedef std::pair<std::string, std::string> StringPair;
23 25
24 // Common test results. 26 // Common test results.
25 static const char kEnded[]; 27 static const char kEnded[];
26 // TODO(xhwang): Report detailed errors, e.g. "ERROR-3". 28 // TODO(xhwang): Report detailed errors, e.g. "ERROR-3".
27 static const char kError[]; 29 static const char kError[];
28 static const char kFailed[]; 30 static const char kFailed[];
31 static const char kPluginCrashed[];
29 32
30 MediaBrowserTest(); 33 MediaBrowserTest();
31 virtual ~MediaBrowserTest(); 34 virtual ~MediaBrowserTest();
32 35
33 // Runs a html page with a list of URL query parameters. 36 // 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 37 // 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. 38 // page, otherwise a local file URL is loaded inside the content shell.
36 // It uses RunTest() to check for expected test output. 39 // It uses RunTest() to check for expected test output.
37 void RunMediaTestPage(const std::string& html_page, 40 void RunMediaTestPage(const std::string& html_page,
38 std::vector<StringPair>* query_params, 41 std::vector<StringPair>* query_params,
39 const std::string& expected, bool http); 42 const std::string& expected, bool http);
40 43
41 // 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
42 // default strings or the expected string. 45 // default strings or the expected string.
43 base::string16 RunTest(const GURL& gurl, const std::string& expected); 46 base::string16 RunTest(const GURL& gurl, const std::string& expected);
44 47
45 virtual void AddWaitForTitles(content::TitleWatcher* title_watcher); 48 virtual void AddWaitForTitles(content::TitleWatcher* title_watcher);
49
50 // Fails test and sets document title to kPluginCrashed when a plugin crashes.
51 // If IgnorePluginCrash(true) is called then plugin crash is ignored.
52 virtual void PluginCrashed(const base::FilePath& plugin_path,
53 base::ProcessId plugin_pid) OVERRIDE;
54
55 // Sets whether plugin crash should be ignored or not. Default is false.
56 void IgnorePluginCrash(bool ignore);
ddorwin 2014/03/21 17:06:29 nit: This should probably either not take a bool o
shadi1 2014/03/21 18:43:54 I think not having it take a bool seems good (unti
57
58 private:
59 bool ignore_plugin_crash_;
46 }; 60 };
47 61
48 #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