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.h" | 6 #include "base/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" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 string ExpectedInfo(string prefix, | 49 string ExpectedInfo(string prefix, |
50 string id, | 50 string id, |
51 string suffix) { | 51 string suffix) { |
52 static const string kstatic_part1 = string( | 52 static const string kstatic_part1 = string( |
53 "{\"constraints\":\"c\","); | 53 "{\"constraints\":\"c\","); |
54 static const string kstatic_part2 = string( | 54 static const string kstatic_part2 = string( |
55 ",\"servers\":\"s\",\"url\":\"u\"}"); | 55 ",\"servers\":\"s\",\"url\":\"u\"}"); |
56 return prefix + kstatic_part1 + id + kstatic_part2 + suffix; | 56 return prefix + kstatic_part1 + id + kstatic_part2 + suffix; |
57 } | 57 } |
58 | 58 |
59 MessageLoop io_loop_; | 59 base::MessageLoop io_loop_; |
60 TestBrowserThread io_thread_; | 60 TestBrowserThread io_thread_; |
61 }; | 61 }; |
62 | 62 |
63 } // namespace | 63 } // namespace |
64 | 64 |
65 TEST_F(WebRTCInternalsTest, AddRemoveObserver) { | 65 TEST_F(WebRTCInternalsTest, AddRemoveObserver) { |
66 scoped_ptr<MockWebRTCInternalsProxy> observer( | 66 scoped_ptr<MockWebRTCInternalsProxy> observer( |
67 new MockWebRTCInternalsProxy()); | 67 new MockWebRTCInternalsProxy()); |
68 WebRTCInternals::GetInstance()->AddObserver(observer.get()); | 68 WebRTCInternals::GetInstance()->AddObserver(observer.get()); |
69 WebRTCInternals::GetInstance()->RemoveObserver(observer.get()); | 69 WebRTCInternals::GetInstance()->RemoveObserver(observer.get()); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 EXPECT_TRUE(dict->GetString("type", &value)); | 151 EXPECT_TRUE(dict->GetString("type", &value)); |
152 EXPECT_EQ(update_type, value); | 152 EXPECT_EQ(update_type, value); |
153 EXPECT_TRUE(dict->GetString("value", &value)); | 153 EXPECT_TRUE(dict->GetString("value", &value)); |
154 EXPECT_EQ(update_value, value); | 154 EXPECT_EQ(update_value, value); |
155 | 155 |
156 WebRTCInternals::GetInstance()->OnRemovePeerConnection(1, 2); | 156 WebRTCInternals::GetInstance()->OnRemovePeerConnection(1, 2); |
157 WebRTCInternals::GetInstance()->RemoveObserver(observer.get()); | 157 WebRTCInternals::GetInstance()->RemoveObserver(observer.get()); |
158 } | 158 } |
159 | 159 |
160 } // namespace content | 160 } // namespace content |
OLD | NEW |