OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #include "content/browser/media/webrtc_internals.h" | 8 #include "content/browser/media/webrtc_internals.h" |
9 #include "content/browser/media/webrtc_internals_ui_observer.h" | 9 #include "content/browser/media/webrtc_internals_ui_observer.h" |
10 #include "content/public/test/test_browser_thread.h" | 10 #include "content/public/test/test_browser_thread.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 static const std::string kContraints = "c"; | 17 static const std::string kContraints = "c"; |
18 static const std::string kServers = "s"; | 18 static const std::string kServers = "s"; |
19 static const std::string kUrl = "u"; | 19 static const std::string kUrl = "u"; |
20 | 20 |
21 class MockWebRTCInternalsProxy : public WebRTCInternalsUIObserver { | 21 class MockWebRTCInternalsProxy : public WebRTCInternalsUIObserver { |
22 public: | 22 public: |
23 virtual void OnUpdate(const std::string& command, | 23 virtual void OnUpdate(const std::string& command, |
24 const base::Value* value) OVERRIDE { | 24 const base::Value* value) OVERRIDE { |
25 command_ = command; | 25 command_ = command; |
26 value_.reset(value->DeepCopy()); | 26 if (value) |
| 27 value_.reset(value->DeepCopy()); |
27 } | 28 } |
28 | 29 |
29 std::string command() { | 30 std::string command() { |
30 return command_; | 31 return command_; |
31 } | 32 } |
32 | 33 |
33 base::Value* value() { | 34 base::Value* value() { |
34 return value_.get(); | 35 return value_.get(); |
35 } | 36 } |
36 | 37 |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 | 264 |
264 EXPECT_EQ("addStats", observer->command()); | 265 EXPECT_EQ("addStats", observer->command()); |
265 base::DictionaryValue* dict = NULL; | 266 base::DictionaryValue* dict = NULL; |
266 EXPECT_TRUE(observer->value()->GetAsDictionary(&dict)); | 267 EXPECT_TRUE(observer->value()->GetAsDictionary(&dict)); |
267 | 268 |
268 VerifyInt(dict, "pid", pid); | 269 VerifyInt(dict, "pid", pid); |
269 VerifyInt(dict, "lid", lid); | 270 VerifyInt(dict, "lid", lid); |
270 VerifyList(dict, "reports", list); | 271 VerifyList(dict, "reports", list); |
271 } | 272 } |
272 | 273 |
| 274 TEST_F(WebRTCInternalsTest, AecRecordingFileSelectionCanceled) { |
| 275 scoped_ptr<MockWebRTCInternalsProxy> observer(new MockWebRTCInternalsProxy()); |
| 276 WebRTCInternals::GetInstance()->AddObserver(observer.get()); |
| 277 WebRTCInternals::GetInstance()->FileSelectionCanceled(NULL); |
| 278 EXPECT_EQ("aecRecordingFileSelectionCancelled", observer->command()); |
| 279 EXPECT_EQ(NULL, observer->value()); |
| 280 } |
| 281 |
273 } // namespace content | 282 } // namespace content |
OLD | NEW |