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

Side by Side Diff: content/browser/encrypted_media_browsertest.cc

Issue 11273049: Revert 164120 - content/browser: Move more files into the content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 1 month 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/string16.h" 8 #include "base/string16.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "content/browser/web_contents/web_contents_impl.h" 12 #include "content/browser/web_contents/web_contents_impl.h"
13 #include "content/public/common/content_switches.h" 13 #include "content/public/common/content_switches.h"
14 #include "content/public/test/browser_test_utils.h" 14 #include "content/public/test/browser_test_utils.h"
15 #include "content/shell/shell.h" 15 #include "content/shell/shell.h"
16 #include "content/test/content_browser_test.h" 16 #include "content/test/content_browser_test.h"
17 #include "content/test/content_browser_test_utils.h" 17 #include "content/test/content_browser_test_utils.h"
18 #include "googleurl/src/gurl.h" 18 #include "googleurl/src/gurl.h"
19 #include "webkit/media/crypto/key_systems.h" 19 #include "webkit/media/crypto/key_systems.h"
20 20
21 namespace content {
22
23 // Platform-specific filename relative to the chrome executable. 21 // Platform-specific filename relative to the chrome executable.
24 #if defined(OS_WIN) 22 #if defined(OS_WIN)
25 const wchar_t kLibraryName[] = L"clearkeycdmplugin.dll"; 23 static const wchar_t kLibraryName[] = L"clearkeycdmplugin.dll";
26 #elif defined(OS_MACOSX) 24 #elif defined(OS_MACOSX)
27 const char kLibraryName[] = "clearkeycdmplugin.plugin"; 25 static const char kLibraryName[] = "clearkeycdmplugin.plugin";
28 #elif defined(OS_POSIX) 26 #elif defined(OS_POSIX)
29 const char kLibraryName[] = "libclearkeycdmplugin.so"; 27 static const char kLibraryName[] = "libclearkeycdmplugin.so";
30 #endif 28 #endif
31 29
32 // Available key systems. 30 // Available key systems.
33 const char kClearKeyKeySystem[] = "webkit-org.w3.clearkey"; 31 static const char kClearKeyKeySystem[] = "webkit-org.w3.clearkey";
34 const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey"; 32 static const char kExternalClearKeyKeySystem[] =
33 "org.chromium.externalclearkey";
35 34
36 class EncryptedMediaTest : public testing::WithParamInterface<const char*>, 35
37 public ContentBrowserTest { 36 class EncryptedMediaTest
37 : public testing::WithParamInterface<const char*>,
38 public content::ContentBrowserTest {
38 public: 39 public:
39 void TestSimplePlayback(const char* encrypted_video, const char* key_system, 40 void TestSimplePlayback(const char* encrypted_video, const char* key_system,
40 const string16 expectation) { 41 const string16 expectation) {
41 PlayEncryptedMedia("encrypted_media_player.html", encrypted_video, 42 PlayEncryptedMedia("encrypted_media_player.html", encrypted_video,
42 key_system, expectation); 43 key_system, expectation);
43 } 44 }
44 45
45 void TestFrameSizeChange(const char* key_system, const string16 expectation) { 46 void TestFrameSizeChange(const char* key_system, const string16 expectation) {
46 PlayEncryptedMedia("encrypted_frame_size_change.html", 47 PlayEncryptedMedia("encrypted_frame_size_change.html",
47 "frame_size_change-av-enc-v.webm", key_system, 48 "frame_size_change-av-enc-v.webm", key_system,
48 expectation); 49 expectation);
49 } 50 }
50 51
51 void PlayEncryptedMedia(const char* html_page, const char* media_file, 52 void PlayEncryptedMedia(const char* html_page, const char* media_file,
52 const char* key_system, const string16 expectation) { 53 const char* key_system, const string16 expectation) {
53 // TODO(shadi): Add non-HTTP tests once src is supported for EME. 54 // TODO(shadi): Add non-HTTP tests once src is supported for EME.
54 ASSERT_TRUE(test_server()->Start()); 55 ASSERT_TRUE(test_server()->Start());
55 56
56 const string16 kError = ASCIIToUTF16("ERROR"); 57 const string16 kError = ASCIIToUTF16("ERROR");
57 const string16 kFailed = ASCIIToUTF16("FAILED"); 58 const string16 kFailed = ASCIIToUTF16("FAILED");
58 GURL player_gurl = test_server()->GetURL(base::StringPrintf( 59 GURL player_gurl = test_server()->GetURL(base::StringPrintf(
59 "files/media/%s?keysystem=%s&mediafile=%s", html_page, key_system, 60 "files/media/%s?keysystem=%s&mediafile=%s", html_page, key_system,
60 media_file)); 61 media_file));
61 TitleWatcher title_watcher(shell()->web_contents(), expectation); 62 content::TitleWatcher title_watcher(shell()->web_contents(), expectation);
62 title_watcher.AlsoWaitForTitle(kError); 63 title_watcher.AlsoWaitForTitle(kError);
63 title_watcher.AlsoWaitForTitle(kFailed); 64 title_watcher.AlsoWaitForTitle(kFailed);
64 65
65 NavigateToURL(shell(), player_gurl); 66 content::NavigateToURL(shell(), player_gurl);
66 67
67 string16 final_title = title_watcher.WaitAndGetTitle(); 68 string16 final_title = title_watcher.WaitAndGetTitle();
68 EXPECT_EQ(expectation, final_title); 69 EXPECT_EQ(expectation, final_title);
69 70
70 if (final_title == kFailed) { 71 if (final_title == kFailed) {
71 std::string fail_message; 72 std::string fail_message;
72 EXPECT_TRUE(ExecuteJavaScriptAndExtractString( 73 EXPECT_TRUE(content::ExecuteJavaScriptAndExtractString(
73 shell()->web_contents()->GetRenderViewHost(), L"", 74 shell()->web_contents()->GetRenderViewHost(), L"",
74 L"window.domAutomationController.send(failMessage);", &fail_message)); 75 L"window.domAutomationController.send(failMessage);", &fail_message));
75 LOG(INFO) << "Test failed: " << fail_message; 76 LOG(INFO) << "Test failed: " << fail_message;
76 } 77 }
77 } 78 }
78 79
79 protected: 80 protected:
80 // Registers any CDM plugins not registered by default. 81 // Registers any CDM plugins not registered by default.
81 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 82 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
82 command_line->AppendSwitch(switches::kDisableAudio); 83 command_line->AppendSwitch(switches::kDisableAudio);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 } 123 }
123 124
124 INSTANTIATE_TEST_CASE_P(ClearKey, EncryptedMediaTest, 125 INSTANTIATE_TEST_CASE_P(ClearKey, EncryptedMediaTest,
125 ::testing::Values(kClearKeyKeySystem)); 126 ::testing::Values(kClearKeyKeySystem));
126 127
127 // http://crbug.com/152864 (Mac) and http://crbug.com/157759 (ASAN on Aura) 128 // http://crbug.com/152864 (Mac) and http://crbug.com/157759 (ASAN on Aura)
128 #if !defined(OS_MACOSX) && !(defined(ADDRESS_SANITIZER) && defined(USE_AURA)) 129 #if !defined(OS_MACOSX) && !(defined(ADDRESS_SANITIZER) && defined(USE_AURA))
129 INSTANTIATE_TEST_CASE_P(ExternalClearKey, EncryptedMediaTest, 130 INSTANTIATE_TEST_CASE_P(ExternalClearKey, EncryptedMediaTest,
130 ::testing::Values(kExternalClearKeyKeySystem)); 131 ::testing::Values(kExternalClearKeyKeySystem));
131 #endif 132 #endif
132
133 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/cross_site_request_manager.cc ('k') | content/browser/fileapi/fileapi_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698