| 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/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/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "content/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch( | 138 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch( |
| 139 switches::kUseFakeUIForMediaStream)); | 139 switches::kUseFakeUIForMediaStream)); |
| 140 } | 140 } |
| 141 | 141 |
| 142 protected: | 142 protected: |
| 143 bool ExecuteJavascript(const string& javascript) { | 143 bool ExecuteJavascript(const string& javascript) { |
| 144 return ExecuteScript(shell()->web_contents(), javascript); | 144 return ExecuteScript(shell()->web_contents(), javascript); |
| 145 } | 145 } |
| 146 | 146 |
| 147 void ExpectTitle(const std::string& expected_title) const { | 147 void ExpectTitle(const std::string& expected_title) const { |
| 148 string16 expected_title16(ASCIIToUTF16(expected_title)); | 148 base::string16 expected_title16(ASCIIToUTF16(expected_title)); |
| 149 TitleWatcher title_watcher(shell()->web_contents(), expected_title16); | 149 TitleWatcher title_watcher(shell()->web_contents(), expected_title16); |
| 150 EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle()); | 150 EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle()); |
| 151 } | 151 } |
| 152 | 152 |
| 153 // Execute the javascript of addPeerConnection. | 153 // Execute the javascript of addPeerConnection. |
| 154 void ExecuteAddPeerConnectionJs(const PeerConnectionEntry& pc) { | 154 void ExecuteAddPeerConnectionJs(const PeerConnectionEntry& pc) { |
| 155 std::stringstream ss; | 155 std::stringstream ss; |
| 156 ss << "{pid:" << pc.pid_ <<", lid:" << pc.lid_ << ", " << | 156 ss << "{pid:" << pc.pid_ <<", lid:" << pc.lid_ << ", " << |
| 157 "url:'u', servers:'s', constraints:'c'}"; | 157 "url:'u', servers:'s', constraints:'c'}"; |
| 158 ASSERT_TRUE(ExecuteJavascript("addPeerConnection(" + ss.str() + ");")); | 158 ASSERT_TRUE(ExecuteJavascript("addPeerConnection(" + ss.str() + ");")); |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 ASSERT_TRUE(ExecuteScriptAndExtractString( | 709 ASSERT_TRUE(ExecuteScriptAndExtractString( |
| 710 shell()->web_contents(), | 710 shell()->web_contents(), |
| 711 "window.domAutomationController.send(" | 711 "window.domAutomationController.send(" |
| 712 "JSON.stringify(peerConnectionDataStore));", | 712 "JSON.stringify(peerConnectionDataStore));", |
| 713 &dump_json)); | 713 &dump_json)); |
| 714 dump.reset(base::JSONReader::Read(dump_json)); | 714 dump.reset(base::JSONReader::Read(dump_json)); |
| 715 VerifyStatsDump(dump.get(), pc_0, type, id, stats); | 715 VerifyStatsDump(dump.get(), pc_0, type, id, stats); |
| 716 } | 716 } |
| 717 | 717 |
| 718 } // namespace content | 718 } // namespace content |
| OLD | NEW |