OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/test/media_router/media_router_integration_browsertest.h" | 5 #include "chrome/test/media_router/media_router_integration_browsertest.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/json/json_file_value_serializer.h" | 9 #include "base/json/json_file_value_serializer.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 CHECK(dialog_contents); | 151 CHECK(dialog_contents); |
152 return dialog_contents; | 152 return dialog_contents; |
153 } | 153 } |
154 | 154 |
155 void MediaRouterIntegrationBrowserTest::SetTestData( | 155 void MediaRouterIntegrationBrowserTest::SetTestData( |
156 base::FilePath::StringPieceType test_data_file) { | 156 base::FilePath::StringPieceType test_data_file) { |
157 base::FilePath full_path = GetResourceFile(test_data_file); | 157 base::FilePath full_path = GetResourceFile(test_data_file); |
158 JSONFileValueDeserializer deserializer(full_path); | 158 JSONFileValueDeserializer deserializer(full_path); |
159 int error_code = 0; | 159 int error_code = 0; |
160 std::string error_message; | 160 std::string error_message; |
161 scoped_ptr<base::Value> value( | 161 scoped_ptr<base::Value> value = |
162 deserializer.Deserialize(&error_code, &error_message)); | 162 deserializer.Deserialize(&error_code, &error_message); |
163 CHECK(value.get()) << "Deserialize failed: " << error_message; | 163 CHECK(value.get()) << "Deserialize failed: " << error_message; |
164 std::string test_data_str; | 164 std::string test_data_str; |
165 ASSERT_TRUE(base::JSONWriter::Write(*value, &test_data_str)); | 165 ASSERT_TRUE(base::JSONWriter::Write(*value, &test_data_str)); |
166 ExecuteScriptInBackgroundPageNoWait( | 166 ExecuteScriptInBackgroundPageNoWait( |
167 extension_id_, | 167 extension_id_, |
168 base::StringPrintf("localStorage['testdata'] = '%s'", | 168 base::StringPrintf("localStorage['testdata'] = '%s'", |
169 test_data_str.c_str())); | 169 test_data_str.c_str())); |
170 } | 170 } |
171 | 171 |
172 content::WebContents* MediaRouterIntegrationBrowserTest::OpenMRDialog( | 172 content::WebContents* MediaRouterIntegrationBrowserTest::OpenMRDialog( |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 content::WebContents* new_web_contents = | 367 content::WebContents* new_web_contents = |
368 browser()->tab_strip_model()->GetActiveWebContents(); | 368 browser()->tab_strip_model()->GetActiveWebContents(); |
369 ASSERT_TRUE(new_web_contents); | 369 ASSERT_TRUE(new_web_contents); |
370 ExecuteJavaScriptAPI( | 370 ExecuteJavaScriptAPI( |
371 new_web_contents, | 371 new_web_contents, |
372 base::StringPrintf("checkReconnectSessionFails('%s');", | 372 base::StringPrintf("checkReconnectSessionFails('%s');", |
373 session_id.c_str())); | 373 session_id.c_str())); |
374 } | 374 } |
375 | 375 |
376 } // namespace media_router | 376 } // namespace media_router |
OLD | NEW |