Update libjingle to CL 53398036.
Review URL: https://webrtc-codereview.appspot.com/2323004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@4872 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -30,6 +30,13 @@
|
||||
|
||||
// Utilities for testing talk_base infrastructure in unittests
|
||||
|
||||
#ifdef LINUX
|
||||
#include <X11/Xlib.h>
|
||||
// X defines a few macros that stomp on types that gunit.h uses.
|
||||
#undef None
|
||||
#undef Bool
|
||||
#endif
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include "talk/base/asyncsocket.h"
|
||||
@@ -565,6 +572,38 @@ inline AssertionResult CmpHelperFileEq(const char* expected_expression,
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Helpers for determining if X/screencasting is available (on linux).
|
||||
|
||||
#define MAYBE_SKIP_SCREENCAST_TEST() \
|
||||
if (!testing::IsScreencastingAvailable()) { \
|
||||
LOG(LS_WARNING) << "Skipping test, since it doesn't have the requisite " \
|
||||
<< "X environment for screen capture."; \
|
||||
return; \
|
||||
} \
|
||||
|
||||
#ifdef LINUX
|
||||
struct XDisplay {
|
||||
XDisplay() : display_(XOpenDisplay(NULL)) { }
|
||||
~XDisplay() { if (display_) XCloseDisplay(display_); }
|
||||
bool IsValid() const { return display_ != NULL; }
|
||||
operator Display*() { return display_; }
|
||||
private:
|
||||
Display* display_;
|
||||
};
|
||||
#endif
|
||||
|
||||
// Returns true if screencasting is available. When false, anything that uses
|
||||
// screencasting features may fail.
|
||||
inline bool IsScreencastingAvailable() {
|
||||
#ifdef LINUX
|
||||
XDisplay display;
|
||||
if (!display.IsValid()) {
|
||||
LOG(LS_WARNING) << "No X Display available.";
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
} // namespace testing
|
||||
|
||||
#endif // TALK_BASE_TESTUTILS_H__
|
||||
|
Reference in New Issue
Block a user