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

Unified Diff: chrome/browser/extensions/api/desktop_capture/desktop_capture_apitest.cc

Issue 1758463002: Add browser test cases for tab and audio share, which are new functionality of desktop share. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/api/desktop_capture/desktop_capture_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/desktop_capture/desktop_capture_apitest.cc
diff --git a/chrome/browser/extensions/api/desktop_capture/desktop_capture_apitest.cc b/chrome/browser/extensions/api/desktop_capture/desktop_capture_apitest.cc
index 42b7e947cad568c7172d6b47c2035bda4e5f17d0..837d8ea47a7fc3455689802cb4619a42c8e62a25 100644
--- a/chrome/browser/extensions/api/desktop_capture/desktop_capture_apitest.cc
+++ b/chrome/browser/extensions/api/desktop_capture/desktop_capture_apitest.cc
@@ -18,6 +18,7 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/test/browser_test_utils.h"
+#include "extensions/common/switches.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_capture_types.h"
@@ -29,6 +30,8 @@ namespace {
struct TestFlags {
bool expect_screens;
bool expect_windows;
+ bool expect_tabs;
+ bool expect_audio;
content::DesktopMediaID selected_source;
bool cancelled;
@@ -96,12 +99,16 @@ class FakeDesktopMediaPickerFactory :
// DesktopCaptureChooseDesktopMediaFunction::PickerFactory interface.
scoped_ptr<DesktopMediaList> CreateModel(bool show_screens,
- bool show_windows) override {
+ bool show_windows,
+ bool show_tabs,
+ bool show_audio) override {
EXPECT_LE(current_test_, tests_count_);
if (current_test_ >= tests_count_)
return scoped_ptr<DesktopMediaList>();
EXPECT_EQ(test_flags_[current_test_].expect_screens, show_screens);
EXPECT_EQ(test_flags_[current_test_].expect_windows, show_windows);
+ EXPECT_EQ(test_flags_[current_test_].expect_tabs, show_tabs);
+ EXPECT_EQ(test_flags_[current_test_].expect_audio, show_audio);
return scoped_ptr<DesktopMediaList>(new FakeDesktopMediaList());
}
@@ -154,34 +161,52 @@ class DesktopCaptureApiTest : public ExtensionApiTest {
#define MAYBE_ChooseDesktopMedia ChooseDesktopMedia
#endif
IN_PROC_BROWSER_TEST_F(DesktopCaptureApiTest, MAYBE_ChooseDesktopMedia) {
+ // For tab and audio share, we need to turn on the flag, because the
+ // functionality is currently behind the flags.
+ base::CommandLine::ForCurrentProcess()->AppendSwitch(
+ extensions::switches::kEnableTabForDesktopShare);
+ base::CommandLine::ForCurrentProcess()->AppendSwitch(
+ extensions::switches::kEnableDesktopCaptureAudio);
+
+ content::DesktopMediaID media_id_tab_audio(
+ content::DesktopMediaID::TYPE_WEB_CONTENTS, 0);
+ media_id_tab_audio.audio_share = true;
GeorgeZ 2016/03/01 23:23:23 You may modify constructor DesktopMediaID(Type typ
qiangchen 2016/03/03 23:56:01 Done.
+
+ content::DesktopMediaID media_id_win_audio(
+ content::DesktopMediaID::TYPE_WINDOW, 0);
+ media_id_win_audio.audio_share = true;
+
// Each element in the following array corresponds to one test in
// chrome/test/data/extensions/api_test/desktop_capture/test.js .
TestFlags test_flags[] = {
- // pickerUiCanceled()
- { true, true,
- content::DesktopMediaID() },
- // chooseMedia()
- { true, true,
- content::DesktopMediaID(content::DesktopMediaID::TYPE_SCREEN,
- content::DesktopMediaID::kNullId) },
- // screensOnly()
- { true, false,
- content::DesktopMediaID() },
- // WindowsOnly()
- { false, true,
- content::DesktopMediaID() },
- // chooseMediaAndGetStream()
- { true, true,
- content::DesktopMediaID(content::DesktopMediaID::TYPE_SCREEN,
- webrtc::kFullDesktopScreenId) },
- // chooseMediaAndTryGetStreamWithInvalidId()
- { true, true,
- content::DesktopMediaID(content::DesktopMediaID::TYPE_SCREEN,
- webrtc::kFullDesktopScreenId) },
- // cancelDialog()
- { true, true,
- content::DesktopMediaID(), true },
- };
+ // pickerUiCanceled()
+ {true, true, false, false, content::DesktopMediaID()},
+ // chooseMedia()
+ {true, true, false, false,
+ content::DesktopMediaID(content::DesktopMediaID::TYPE_SCREEN,
+ content::DesktopMediaID::kNullId)},
+ // screensOnly()
+ {true, false, false, false, content::DesktopMediaID()},
+ // WindowsOnly()
+ {false, true, false, false, content::DesktopMediaID()},
+ // chooseMediaAndGetStream()
+ {true, true, false, false,
+ content::DesktopMediaID(content::DesktopMediaID::TYPE_SCREEN,
+ webrtc::kFullDesktopScreenId)},
+ // chooseMediaAndTryGetStreamWithInvalidId()
+ {true, true, false, false,
+ content::DesktopMediaID(content::DesktopMediaID::TYPE_SCREEN,
+ webrtc::kFullDesktopScreenId)},
+ // cancelDialog()
+ {true, true, false, false, content::DesktopMediaID(), true},
+ // tabShare()
+ {true, true, true, false, content::DesktopMediaID()},
+ // audioShare()
+ {true, true, false, true, content::DesktopMediaID()},
+ // tabShareWithAudioGetStream()
+ {false, false, true, true, media_id_tab_audio},
+ // windowShareWithAudioGetStream()
+ {false, true, false, true, media_id_win_audio}};
picker_factory_.SetTestFlags(test_flags, arraysize(test_flags));
ASSERT_TRUE(RunExtensionTest("desktop_capture")) << message_;
}
@@ -207,15 +232,16 @@ IN_PROC_BROWSER_TEST_F(DesktopCaptureApiTest, DISABLED_Delegation) {
browser(), GetURLForPath("example.com", "/example.com.html"));
TestFlags test_flags[] = {
- { true, true,
- content::DesktopMediaID(content::DesktopMediaID::TYPE_SCREEN,
- content::DesktopMediaID::kNullId) },
- { true, true,
- content::DesktopMediaID(content::DesktopMediaID::TYPE_SCREEN,
- content::DesktopMediaID::kNullId) },
- { true, true,
- content::DesktopMediaID(content::DesktopMediaID::TYPE_SCREEN,
- content::DesktopMediaID::kNullId), true },
+ {true, true, false, false,
+ content::DesktopMediaID(content::DesktopMediaID::TYPE_SCREEN,
+ content::DesktopMediaID::kNullId)},
+ {true, true, false, false,
+ content::DesktopMediaID(content::DesktopMediaID::TYPE_SCREEN,
+ content::DesktopMediaID::kNullId)},
+ {true, true, false, false,
+ content::DesktopMediaID(content::DesktopMediaID::TYPE_SCREEN,
+ content::DesktopMediaID::kNullId),
+ true},
};
picker_factory_.SetTestFlags(test_flags, arraysize(test_flags));
« no previous file with comments | « no previous file | chrome/browser/extensions/api/desktop_capture/desktop_capture_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698