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

Unified Diff: content/shell/renderer/test_runner/MockConstraints.cpp

Issue 295983008: test_runner: Migrate MockConstraint to our Chromium C++ style. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
Index: content/shell/renderer/test_runner/MockConstraints.cpp
diff --git a/content/shell/renderer/test_runner/MockConstraints.cpp b/content/shell/renderer/test_runner/MockConstraints.cpp
deleted file mode 100644
index 7e018721020d88303fd8e3c65cd17c6075879af2..0000000000000000000000000000000000000000
--- a/content/shell/renderer/test_runner/MockConstraints.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/shell/renderer/test_runner/MockConstraints.h"
-
-#include "third_party/WebKit/public/platform/WebMediaConstraints.h"
-#include "third_party/WebKit/public/platform/WebString.h"
-
-using namespace blink;
-
-namespace content {
-
-namespace {
-
-bool isSupported(const WebString& constraint)
-{
- return constraint == "valid_and_supported_1" || constraint == "valid_and_supported_2";
-}
-
-bool isValid(const WebString& constraint)
-{
- return isSupported(constraint) || constraint == "valid_but_unsupported_1" || constraint == "valid_but_unsupported_2";
-}
-
-}
-
-bool MockConstraints::verifyConstraints(const WebMediaConstraints& constraints, WebString* failedConstraint)
-{
- WebVector<WebMediaConstraint> mandatoryConstraints;
- constraints.getMandatoryConstraints(mandatoryConstraints);
- if (mandatoryConstraints.size()) {
- for (size_t i = 0; i < mandatoryConstraints.size(); ++i) {
- const WebMediaConstraint& curr = mandatoryConstraints[i];
- if (!isSupported(curr.m_name) || curr.m_value != "1") {
- if (failedConstraint)
- *failedConstraint = curr.m_name;
- return false;
- }
- }
- }
-
- WebVector<WebMediaConstraint> optionalConstraints;
- constraints.getOptionalConstraints(optionalConstraints);
- if (optionalConstraints.size()) {
- for (size_t i = 0; i < optionalConstraints.size(); ++i) {
- const WebMediaConstraint& curr = optionalConstraints[i];
- if (!isValid(curr.m_name) || curr.m_value != "0") {
- if (failedConstraint)
- *failedConstraint = curr.m_name;
- return false;
- }
- }
- }
-
- return true;
-}
-
-} // namespace content

Powered by Google App Engine
This is Rietveld 408576698