OLD | NEW |
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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/json/json_reader.h" | 6 #include "base/json/json_reader.h" |
7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "chrome/browser/media/webrtc/webrtc_browsertest_base.h" | 8 #include "chrome/browser/media/webrtc/webrtc_browsertest_base.h" |
9 #include "chrome/browser/media/webrtc/webrtc_browsertest_common.h" | 9 #include "chrome/browser/media/webrtc/webrtc_browsertest_common.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 std::string devices_as_json = ExecuteJavascript("enumerateDevices()", tab); | 68 std::string devices_as_json = ExecuteJavascript("enumerateDevices()", tab); |
69 EXPECT_FALSE(devices_as_json.empty()); | 69 EXPECT_FALSE(devices_as_json.empty()); |
70 | 70 |
71 int error_code; | 71 int error_code; |
72 std::string error_message; | 72 std::string error_message; |
73 std::unique_ptr<base::Value> value = base::JSONReader::ReadAndReturnError( | 73 std::unique_ptr<base::Value> value = base::JSONReader::ReadAndReturnError( |
74 devices_as_json, base::JSON_ALLOW_TRAILING_COMMAS, &error_code, | 74 devices_as_json, base::JSON_ALLOW_TRAILING_COMMAS, &error_code, |
75 &error_message); | 75 &error_message); |
76 | 76 |
77 ASSERT_TRUE(value.get() != NULL) << error_message; | 77 ASSERT_TRUE(value.get() != NULL) << error_message; |
78 EXPECT_EQ(value->GetType(), base::Value::TYPE_LIST); | 78 EXPECT_EQ(value->GetType(), base::Value::Type::LIST); |
79 | 79 |
80 base::ListValue* values; | 80 base::ListValue* values; |
81 ASSERT_TRUE(value->GetAsList(&values)); | 81 ASSERT_TRUE(value->GetAsList(&values)); |
82 ASSERT_FALSE(values->empty()); | 82 ASSERT_FALSE(values->empty()); |
83 bool found_audio_input = false; | 83 bool found_audio_input = false; |
84 bool found_video_input = false; | 84 bool found_video_input = false; |
85 bool found_audio_output = false; | 85 bool found_audio_output = false; |
86 | 86 |
87 for (base::ListValue::iterator it = values->begin(); | 87 for (base::ListValue::iterator it = values->begin(); |
88 it != values->end(); ++it) { | 88 it != values->end(); ++it) { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 168 |
169 std::vector<MediaDeviceInfo> devices; | 169 std::vector<MediaDeviceInfo> devices; |
170 EnumerateDevices(tab, &devices); | 170 EnumerateDevices(tab, &devices); |
171 | 171 |
172 // Labels should be non-empty if access has been allowed. | 172 // Labels should be non-empty if access has been allowed. |
173 for (std::vector<MediaDeviceInfo>::iterator it = devices.begin(); | 173 for (std::vector<MediaDeviceInfo>::iterator it = devices.begin(); |
174 it != devices.end(); ++it) { | 174 it != devices.end(); ++it) { |
175 EXPECT_TRUE(!it->label.empty()); | 175 EXPECT_TRUE(!it->label.empty()); |
176 } | 176 } |
177 } | 177 } |
OLD | NEW |