Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1392)

Side by Side Diff: chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_apitest.cc

Issue 569493003: Remove CreateEmptyExtension from extension_function_test_utils (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/json/json_writer.h" 5 #include "base/json/json_writer.h"
6 #include "base/strings/string_split.h" 6 #include "base/strings/string_split.h"
7 #include "chrome/browser/browser_process.h" 7 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_pr ivate_api.h" 8 #include "chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_pr ivate_api.h"
9 #include "chrome/browser/extensions/extension_apitest.h" 9 #include "chrome/browser/extensions/extension_apitest.h"
10 #include "chrome/browser/extensions/extension_function_test_utils.h" 10 #include "chrome/browser/extensions/extension_function_test_utils.h"
11 #include "chrome/browser/extensions/extension_tab_util.h" 11 #include "chrome/browser/extensions/extension_tab_util.h"
12 #include "chrome/browser/media/webrtc_log_uploader.h" 12 #include "chrome/browser/media/webrtc_log_uploader.h"
13 #include "chrome/browser/ui/tabs/tab_strip_model.h" 13 #include "chrome/browser/ui/tabs/tab_strip_model.h"
14 #include "content/public/browser/notification_service.h" 14 #include "content/public/browser/notification_service.h"
15 #include "content/public/test/test_utils.h" 15 #include "content/public/test/test_utils.h"
16 #include "extensions/common/test_util.h"
16 17
17 using extensions::Extension; 18 using extensions::Extension;
18 19
19 namespace utils = extension_function_test_utils; 20 namespace utils = extension_function_test_utils;
20 21
21 namespace { 22 namespace {
22 23
23 static const char kTestLoggingSessionId[] = "0123456789abcdef"; 24 static const char kTestLoggingSessionId[] = "0123456789abcdef";
24 static const char kTestLoggingUrl[] = "dummy url string"; 25 static const char kTestLoggingUrl[] = "dummy url string";
25 26
26 class WebrtcLoggingPrivateApiTest : public ExtensionApiTest { 27 class WebrtcLoggingPrivateApiTest : public ExtensionApiTest {
27 }; 28 };
28 29
29 } // namespace 30 } // namespace
30 31
31 IN_PROC_BROWSER_TEST_F(WebrtcLoggingPrivateApiTest, TestStartStopDiscard) { 32 IN_PROC_BROWSER_TEST_F(WebrtcLoggingPrivateApiTest, TestStartStopDiscard) {
32 scoped_refptr<Extension> empty_extension(utils::CreateEmptyExtension()); 33 scoped_refptr<Extension> empty_extension(
34 extensions::test_util::CreateEmptyExtension());
33 35
34 // Tell the uploader to save the multipart to a buffer instead of uploading. 36 // Tell the uploader to save the multipart to a buffer instead of uploading.
35 std::string multipart; 37 std::string multipart;
36 g_browser_process->webrtc_log_uploader()-> 38 g_browser_process->webrtc_log_uploader()->
37 OverrideUploadWithBufferForTesting(&multipart); 39 OverrideUploadWithBufferForTesting(&multipart);
38 40
39 // Start 41 // Start
40 42
41 scoped_refptr<extensions::WebrtcLoggingPrivateStartFunction> 43 scoped_refptr<extensions::WebrtcLoggingPrivateStartFunction>
42 start_function(new extensions::WebrtcLoggingPrivateStartFunction()); 44 start_function(new extensions::WebrtcLoggingPrivateStartFunction());
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // 115 //
114 // http://127.0.0.1:43213/webrtc/webrtc_jsep01_test.html 116 // http://127.0.0.1:43213/webrtc/webrtc_jsep01_test.html
115 // ------**--yradnuoBgoLtrapitluMklaTelgooG--**---- 117 // ------**--yradnuoBgoLtrapitluMklaTelgooG--**----
116 // Content-Disposition: form-data; name="webrtc_log"; filename="webrtc_log.gz" 118 // Content-Disposition: form-data; name="webrtc_log"; filename="webrtc_log.gz"
117 // Content-Type: application/gzip 119 // Content-Type: application/gzip
118 // 120 //
119 // <compressed data (zip)> 121 // <compressed data (zip)>
120 // ------**--yradnuoBgoLtrapitluMklaTelgooG--**------ 122 // ------**--yradnuoBgoLtrapitluMklaTelgooG--**------
121 // 123 //
122 IN_PROC_BROWSER_TEST_F(WebrtcLoggingPrivateApiTest, TestStartStopUpload) { 124 IN_PROC_BROWSER_TEST_F(WebrtcLoggingPrivateApiTest, TestStartStopUpload) {
123 scoped_refptr<Extension> empty_extension(utils::CreateEmptyExtension()); 125 scoped_refptr<Extension> empty_extension(
126 extensions::test_util::CreateEmptyExtension());
124 127
125 // Tell the uploader to save the multipart to a buffer instead of uploading. 128 // Tell the uploader to save the multipart to a buffer instead of uploading.
126 std::string multipart; 129 std::string multipart;
127 g_browser_process->webrtc_log_uploader()-> 130 g_browser_process->webrtc_log_uploader()->
128 OverrideUploadWithBufferForTesting(&multipart); 131 OverrideUploadWithBufferForTesting(&multipart);
129 132
130 // SetMetaData. 133 // SetMetaData.
131 134
132 scoped_refptr<extensions::WebrtcLoggingPrivateSetMetaDataFunction> 135 scoped_refptr<extensions::WebrtcLoggingPrivateSetMetaDataFunction>
133 set_meta_data_function( 136 set_meta_data_function(
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 std::string final_delimiter = boundary; 274 std::string final_delimiter = boundary;
272 final_delimiter += "--"; 275 final_delimiter += "--";
273 EXPECT_STREQ(final_delimiter.c_str(), multipart_lines[29].c_str()); 276 EXPECT_STREQ(final_delimiter.c_str(), multipart_lines[29].c_str());
274 EXPECT_TRUE(multipart_lines[30].empty()); 277 EXPECT_TRUE(multipart_lines[30].empty());
275 278
276 g_browser_process->webrtc_log_uploader()->OverrideUploadWithBufferForTesting( 279 g_browser_process->webrtc_log_uploader()->OverrideUploadWithBufferForTesting(
277 NULL); 280 NULL);
278 } 281 }
279 282
280 IN_PROC_BROWSER_TEST_F(WebrtcLoggingPrivateApiTest, TestStartStopRtpDump) { 283 IN_PROC_BROWSER_TEST_F(WebrtcLoggingPrivateApiTest, TestStartStopRtpDump) {
281 scoped_refptr<Extension> empty_extension(utils::CreateEmptyExtension()); 284 scoped_refptr<Extension> empty_extension(
285 extensions::test_util::CreateEmptyExtension());
282 286
283 // Start RTP dump. 287 // Start RTP dump.
284 scoped_refptr<extensions::WebrtcLoggingPrivateStartRtpDumpFunction> 288 scoped_refptr<extensions::WebrtcLoggingPrivateStartRtpDumpFunction>
285 start_function( 289 start_function(
286 new extensions::WebrtcLoggingPrivateStartRtpDumpFunction()); 290 new extensions::WebrtcLoggingPrivateStartRtpDumpFunction());
287 start_function->set_extension(empty_extension.get()); 291 start_function->set_extension(empty_extension.get());
288 start_function->set_has_callback(true); 292 start_function->set_has_callback(true);
289 293
290 content::WebContents* contents = 294 content::WebContents* contents =
291 browser()->tab_strip_model()->GetActiveWebContents(); 295 browser()->tab_strip_model()->GetActiveWebContents();
(...skipping 12 matching lines...) Expand all
304 // Stop RTP dump. 308 // Stop RTP dump.
305 scoped_refptr<extensions::WebrtcLoggingPrivateStopRtpDumpFunction> 309 scoped_refptr<extensions::WebrtcLoggingPrivateStopRtpDumpFunction>
306 stop_function(new extensions::WebrtcLoggingPrivateStopRtpDumpFunction()); 310 stop_function(new extensions::WebrtcLoggingPrivateStopRtpDumpFunction());
307 stop_function->set_extension(empty_extension.get()); 311 stop_function->set_extension(empty_extension.get());
308 stop_function->set_has_callback(true); 312 stop_function->set_has_callback(true);
309 313
310 result.reset(utils::RunFunctionAndReturnSingleResult( 314 result.reset(utils::RunFunctionAndReturnSingleResult(
311 stop_function.get(), parameter_string, browser())); 315 stop_function.get(), parameter_string, browser()));
312 ASSERT_FALSE(result.get()); 316 ASSERT_FALSE(result.get());
313 } 317 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/tabs/tabs_test.cc ('k') | chrome/browser/extensions/extension_function_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698