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

Side by Side Diff: remoting/test/protocol_perftest.cc

Issue 2354263007: Minor fixes for protocol perf tests (Closed)
Patch Set: Created 4 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <numeric> 5 #include <numeric>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/base64.h" 8 #include "base/base64.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 409
410 INSTANTIATE_TEST_CASE_P( 410 INSTANTIATE_TEST_CASE_P(
411 LimitedBandwidth, 411 LimitedBandwidth,
412 ProtocolPerfTest, 412 ProtocolPerfTest,
413 ::testing::Values( 413 ::testing::Values(
414 // 100 Mbps 414 // 100 Mbps
415 NetworkPerformanceParams(12500000, 12500000, 2, 1, 0.0), 415 NetworkPerformanceParams(12500000, 12500000, 2, 1, 0.0),
416 // 8 Mbps 416 // 8 Mbps
417 NetworkPerformanceParams(1000000, 300000, 30, 5, 0.01), 417 NetworkPerformanceParams(1000000, 300000, 30, 5, 0.01),
418 NetworkPerformanceParams(1000000, 2000000, 30, 5, 0.01), 418 NetworkPerformanceParams(1000000, 2000000, 30, 5, 0.01),
419 // 2 Mbps
420 NetworkPerformanceParams(250000, 300000, 30, 5, 0.01),
421 NetworkPerformanceParams(250000, 2000000, 30, 5, 0.01),
419 // 800 kBps 422 // 800 kBps
420 NetworkPerformanceParams(100000, 30000, 130, 5, 0.01), 423 NetworkPerformanceParams(100000, 30000, 130, 5, 0.00),
421 NetworkPerformanceParams(100000, 200000, 130, 5, 0.01))); 424 NetworkPerformanceParams(100000, 200000, 130, 5, 0.00)));
422
423 const int kIntermittentFrameSize = 100 * 1000;
424
425 // Frame generator that rewrites the whole screen every 60th frame. Should only
426 // be used with the VERBATIM codec as the allocated frame may contain arbitrary
427 // data.
428 class IntermittentChangeFrameGenerator
429 : public base::RefCountedThreadSafe<IntermittentChangeFrameGenerator> {
430 public:
431 IntermittentChangeFrameGenerator()
432 : frame_index_(0) {}
433
434 std::unique_ptr<webrtc::DesktopFrame> GenerateFrame(
435 webrtc::SharedMemoryFactory* shared_memory_factory) {
436 const int kWidth = 1000;
437 const int kHeight = kIntermittentFrameSize / kWidth / 4;
438
439 bool fresh_frame = false;
440 if (frame_index_ % 60 == 0 || !current_frame_) {
441 current_frame_.reset(webrtc::SharedDesktopFrame::Wrap(
442 new webrtc::BasicDesktopFrame(webrtc::DesktopSize(kWidth, kHeight))));
443 fresh_frame = true;
444 }
445 ++frame_index_;
446
447 std::unique_ptr<webrtc::DesktopFrame> result(current_frame_->Share());
448 result->mutable_updated_region()->Clear();
449 if (fresh_frame) {
450 result->mutable_updated_region()->AddRect(
451 webrtc::DesktopRect::MakeXYWH(0, 0, kWidth, kHeight));
452 }
453 return result;
454 }
455
456 private:
457 ~IntermittentChangeFrameGenerator() {}
458 friend class base::RefCountedThreadSafe<IntermittentChangeFrameGenerator>;
459
460 int frame_index_;
461 std::unique_ptr<webrtc::SharedDesktopFrame> current_frame_;
462
463 DISALLOW_COPY_AND_ASSIGN(IntermittentChangeFrameGenerator);
464 };
465 425
466 // TotalLatency[Ice|Webrtc] tests measure video latency in the case when the 426 // TotalLatency[Ice|Webrtc] tests measure video latency in the case when the
467 // whole screen is updated occasionally. It's intended to simulate the case when 427 // whole screen is updated occasionally. It's intended to simulate the case when
468 // user actions (e.g. Alt-Tab, click on the task bar) cause whole screen to be 428 // user actions (e.g. Alt-Tab, click on the task bar) cause whole screen to be
469 // updated. 429 // updated.
470 void ProtocolPerfTest::MeasureTotalLatency(bool use_webrtc) { 430 void ProtocolPerfTest::MeasureTotalLatency(bool use_webrtc) {
471 scoped_refptr<test::CyclicFrameGenerator> frame_generator = 431 scoped_refptr<test::CyclicFrameGenerator> frame_generator =
472 test::CyclicFrameGenerator::Create(); 432 test::CyclicFrameGenerator::Create();
473 frame_generator->set_draw_barcode(true); 433 frame_generator->set_draw_barcode(true);
474 434
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 548
589 TEST_P(ProtocolPerfTest, ScrollPerformanceIce) { 549 TEST_P(ProtocolPerfTest, ScrollPerformanceIce) {
590 MeasureScrollPerformance(false); 550 MeasureScrollPerformance(false);
591 } 551 }
592 552
593 TEST_P(ProtocolPerfTest, ScrollPerformanceWebrtc) { 553 TEST_P(ProtocolPerfTest, ScrollPerformanceWebrtc) {
594 MeasureScrollPerformance(true); 554 MeasureScrollPerformance(true);
595 } 555 }
596 556
597 } // namespace remoting 557 } // namespace remoting
OLDNEW
« remoting/test/fake_socket_factory.cc ('K') | « remoting/test/fake_socket_factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698