Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license | |
| 5 * that can be found in the LICENSE file in the root of the source | |
| 6 * tree. An additional intellectual property rights grant can be found | |
| 7 * in the file PATENTS. All contributing project authors may | |
| 8 * be found in the AUTHORS file in the root of the source tree. | |
| 9 */ | |
| 10 | |
| 11 // TODO(zijiehe): Implement ScreenDrawerLinux / ScreenDrawerMac. | |
|
Sergey Ulanov
2016/08/09 17:43:01
Don't you already have it implemented in this CL?
Hzj_jie
2016/08/11 18:42:04
Should be updated, no, I have not implemented Scre
| |
| 12 #if defined(WEBRTC_WIN) || defined(USE_X11) | |
|
Sergey Ulanov
2016/08/09 17:43:01
move this next to the test itself?
Alternatively y
Hzj_jie
2016/08/11 18:42:04
Good point. Done.
| |
| 13 | |
| 14 #include "webrtc/modules/desktop_capture/screen_drawer.h" | |
| 15 | |
| 16 #include <stdint.h> | |
| 17 | |
| 18 #include "testing/gtest/include/gtest/gtest.h" | |
| 19 #include "webrtc/base/random.h" | |
| 20 #include "webrtc/base/timeutils.h" | |
| 21 #include "webrtc/system_wrappers/include/sleep.h" | |
| 22 | |
| 23 namespace webrtc { | |
| 24 | |
| 25 // These are a set of manual test cases, as we do not have an automatical way to | |
| 26 // detect whether a ScreenDrawer on a certain platform works well without | |
| 27 // ScreenCapturer(s). So you may execute these test cases with | |
| 28 // --gtest_also_run_disabled_tests --gtest_filter=ScreenDrawerTest.*. | |
| 29 TEST(ScreenDrawerTest, DISABLED_DrawRectangles) { | |
|
Sergey Ulanov
2016/08/09 17:43:01
MANUAL_ prefix is usually used for manual tests.
Hzj_jie
2016/08/11 18:42:04
Done.
Hzj_jie
2016/08/15 00:37:47
DISABLED_ can block gtest from running this test c
| |
| 30 std::unique_ptr<ScreenDrawer> drawer = ScreenDrawer::Create(); | |
| 31 drawer->Clear(); | |
| 32 DesktopRect rect = drawer->DrawableRegion(); | |
| 33 Random random(rtc::TimeMicros()); | |
| 34 for (int i = 0; i < 100; i++) { | |
| 35 // Make sure we at least draw one pixel. | |
| 36 int left = random.Rand(rect.left(), rect.right() - 2); | |
| 37 int top = random.Rand(rect.top(), rect.bottom() - 2); | |
| 38 drawer->DrawRectangle( | |
| 39 DesktopRect::MakeLTRB(left, top, random.Rand(left + 1, rect.right()), | |
| 40 random.Rand(top + 1, rect.bottom())), | |
| 41 random.Rand<uint32_t>()); | |
|
Sergey Ulanov
2016/08/09 17:43:01
I think you want to limit the range to [0..2^24)?
Hzj_jie
2016/08/11 18:42:04
I still prefer to use RGBA, though both Windows an
| |
| 42 | |
| 43 if (i == 50) { | |
| 44 SleepMs(10000); | |
| 45 drawer->Clear(); | |
| 46 } | |
| 47 } | |
| 48 | |
| 49 SleepMs(10000); | |
| 50 drawer->Clear(); | |
| 51 } | |
| 52 | |
| 53 } // namespace webrtc | |
| 54 | |
| 55 #endif | |
|
Sergey Ulanov
2016/08/09 17:43:01
// defined(WEBRTC_WIN) || defined(USE_X11)
Hzj_jie
2016/08/11 18:42:04
This line has been removed.
| |
| OLD | NEW |