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

Side by Side Diff: chrome/browser/extensions/web_view_browsertest.cc

Issue 11093080: <webview>: First stab at implementing media permission request for guests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Plugin can be destroyed before we get Weak Callback, fixed. Created 7 years, 10 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
« no previous file with comments | « no previous file | chrome/chrome_renderer.gypi » ('j') | chrome/renderer/extensions/dispatcher.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/utf_string_conversions.h" 5 #include "base/utf_string_conversions.h"
6 #include "chrome/browser/automation/automation_util.h" 6 #include "chrome/browser/automation/automation_util.h"
7 #include "chrome/browser/extensions/extension_test_message_listener.h" 7 #include "chrome/browser/extensions/extension_test_message_listener.h"
8 #include "chrome/browser/extensions/platform_app_browsertest_util.h" 8 #include "chrome/browser/extensions/platform_app_browsertest_util.h"
9 #include "chrome/browser/prerender/prerender_link_manager.h" 9 #include "chrome/browser/prerender/prerender_link_manager.h"
10 #include "chrome/browser/prerender/prerender_link_manager_factory.h" 10 #include "chrome/browser/prerender/prerender_link_manager_factory.h"
11 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
12 #include "chrome/browser/ui/tabs/tab_strip_model.h" 12 #include "chrome/browser/ui/tabs/tab_strip_model.h"
13 #include "chrome/common/chrome_switches.h"
13 #include "chrome/test/base/ui_test_utils.h" 14 #include "chrome/test/base/ui_test_utils.h"
14 #include "chrome/test/base/test_launcher_utils.h" 15 #include "chrome/test/base/test_launcher_utils.h"
16 #include "chrome/test/base/ui_test_utils.h"
15 #include "content/public/browser/notification_service.h" 17 #include "content/public/browser/notification_service.h"
16 #include "content/public/browser/render_process_host.h" 18 #include "content/public/browser/render_process_host.h"
17 #include "content/public/test/browser_test_utils.h" 19 #include "content/public/test/browser_test_utils.h"
18 #include "content/public/test/fake_speech_recognition_manager.h" 20 #include "content/public/test/fake_speech_recognition_manager.h"
19 #include "ui/compositor/compositor_setup.h" 21 #include "ui/compositor/compositor_setup.h"
20 #include "ui/gl/gl_switches.h" 22 #include "ui/gl/gl_switches.h"
21 23
22 using prerender::PrerenderLinkManager; 24 using prerender::PrerenderLinkManager;
23 using prerender::PrerenderLinkManagerFactory; 25 using prerender::PrerenderLinkManagerFactory;
24 26
25 class WebViewTest : public extensions::PlatformAppBrowserTest { 27 class WebViewTest : public extensions::PlatformAppBrowserTest {
26 protected: 28 protected:
27 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 29 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
28 extensions::PlatformAppBrowserTest::SetUpCommandLine(command_line); 30 extensions::PlatformAppBrowserTest::SetUpCommandLine(command_line);
29 #if !defined(OS_MACOSX) 31 #if !defined(OS_MACOSX)
30 CHECK(test_launcher_utils::OverrideGLImplementation( 32 CHECK(test_launcher_utils::OverrideGLImplementation(
31 command_line, gfx::kGLImplementationOSMesaName)) << 33 command_line, gfx::kGLImplementationOSMesaName)) <<
32 "kUseGL must not be set by test framework code!"; 34 "kUseGL must not be set by test framework code!";
33 #endif 35 #endif
36 const testing::TestInfo* const test_info =
37 testing::UnitTest::GetInstance()->current_test_info();
38 bool requires_experimental =
39 !strcmp(test_info->name(), "MediaAccessAPIEmbedderHasPermission") ||
40 !strcmp(test_info->name(), "MediaAccessAPIEmbedderHasNoPermission");
41 if (requires_experimental) {
42 CommandLine::ForCurrentProcess()->AppendSwitch(
43 switches::kEnableExperimentalExtensionApis);
44 }
34 } 45 }
35 46
36 virtual void SetUp() OVERRIDE { 47 virtual void SetUp() OVERRIDE {
37 const testing::TestInfo* const test_info = 48 const testing::TestInfo* const test_info =
38 testing::UnitTest::GetInstance()->current_test_info(); 49 testing::UnitTest::GetInstance()->current_test_info();
39 50
40 // SpeechRecognition test specific SetUp. 51 // SpeechRecognition test specific SetUp.
41 if (!strcmp(test_info->name(), "SpeechRecognition")) { 52 if (!strcmp(test_info->name(), "SpeechRecognition")) {
42 fake_speech_recognition_manager_.reset( 53 fake_speech_recognition_manager_.reset(
43 new content::FakeSpeechRecognitionManager()); 54 new content::FakeSpeechRecognitionManager());
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 // Click on the guest (center of the WebContents), the guest is rendered in a 706 // Click on the guest (center of the WebContents), the guest is rendered in a
696 // way that this will trigger clicking on speech recognition input mic. 707 // way that this will trigger clicking on speech recognition input mic.
697 SimulateMouseClick(guest_web_contents, 0, WebKit::WebMouseEvent::ButtonLeft); 708 SimulateMouseClick(guest_web_contents, 0, WebKit::WebMouseEvent::ButtonLeft);
698 709
699 string16 expected_title(ASCIIToUTF16("PASSED")); 710 string16 expected_title(ASCIIToUTF16("PASSED"));
700 string16 error_title(ASCIIToUTF16("FAILED")); 711 string16 error_title(ASCIIToUTF16("FAILED"));
701 content::TitleWatcher title_watcher(guest_web_contents, expected_title); 712 content::TitleWatcher title_watcher(guest_web_contents, expected_title);
702 title_watcher.AlsoWaitForTitle(error_title); 713 title_watcher.AlsoWaitForTitle(error_title);
703 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); 714 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
704 } 715 }
716
717 IN_PROC_BROWSER_TEST_F(WebViewTest, MediaAccessAPIEmbedderHasPermission) {
718 ASSERT_TRUE(StartTestServer()); // For serving guest pages.
719 ASSERT_TRUE(RunPlatformAppTest(
720 "platform_apps/web_view/media_access/embedder_has_permission"))
721 << message_;
722 }
723
724 IN_PROC_BROWSER_TEST_F(WebViewTest, MediaAccessAPIEmbedderHasNoPermission) {
725 ASSERT_TRUE(StartTestServer()); // For serving guest pages.
726 ASSERT_TRUE(RunPlatformAppTest(
727 "platform_apps/web_view/media_access/embedder_has_no_permission"))
728 << message_;
729 }
730
OLDNEW
« no previous file with comments | « no previous file | chrome/chrome_renderer.gypi » ('j') | chrome/renderer/extensions/dispatcher.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698