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

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: Resolve comment 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..7315d2fb072abc7c2872f882a238ac79d4880fde 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,33 +161,61 @@ 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);
+
// 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()},
+ // tabOnly()
+ {false, false, true, false, content::DesktopMediaID()},
+ // audioShare()
+ {true, true, true, true, 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},
+ // tabShareWithAudioGetStream()
+ {false, false, true, true,
+ content::DesktopMediaID(content::DesktopMediaID::TYPE_WEB_CONTENTS, 0,
+ true)},
+ // windowShareWithAudioGetStream()
+ {false, true, false, true,
+ content::DesktopMediaID(content::DesktopMediaID::TYPE_WINDOW, 0, true)},
+ // screenShareWithAudioGetStream()
+ {true, false, false, true,
+ content::DesktopMediaID(content::DesktopMediaID::TYPE_SCREEN,
+ webrtc::kFullDesktopScreenId, true)},
+ // tabShareWithoutAudioGetStream()
+ {false, false, true, true,
+ content::DesktopMediaID(content::DesktopMediaID::TYPE_WEB_CONTENTS, 0)},
+ // windowShareWithoutAudioGetStream()
+ {false, true, false, true,
+ content::DesktopMediaID(content::DesktopMediaID::TYPE_WINDOW, 0)},
+ // screenShareWithoutAudioGetStream()
+ {true, false, false, true,
+ content::DesktopMediaID(content::DesktopMediaID::TYPE_SCREEN,
+ webrtc::kFullDesktopScreenId)},
};
picker_factory_.SetTestFlags(test_flags, arraysize(test_flags));
ASSERT_TRUE(RunExtensionTest("desktop_capture")) << message_;
@@ -207,15 +242,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