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

Side by Side Diff: extensions/browser/guest_view/mime_handler_view/mime_handler_view_browsertest.cc

Issue 1091253004: Fix MimeHandlerView plugin loading for data: URLs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « content/child/web_url_loader_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/base_paths.h" 5 #include "base/base_paths.h"
6 #include "base/files/file_util.h" 6 #include "base/files/file_util.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "chrome/browser/extensions/extension_apitest.h" 8 #include "chrome/browser/extensions/extension_apitest.h"
9 #include "chrome/test/base/ui_test_utils.h" 9 #include "chrome/test/base/ui_test_utils.h"
10 #include "content/public/test/browser_test_utils.h" 10 #include "content/public/test/browser_test_utils.h"
(...skipping 12 matching lines...) Expand all
23 const extensions::Extension* extension = 23 const extensions::Extension* extension =
24 LoadExtension(test_data_dir_.AppendASCII("mime_handler_view")); 24 LoadExtension(test_data_dir_.AppendASCII("mime_handler_view"));
25 if (!extension) 25 if (!extension)
26 return nullptr; 26 return nullptr;
27 27
28 CHECK_EQ(std::string(kExtensionId), extension->id()); 28 CHECK_EQ(std::string(kExtensionId), extension->id());
29 29
30 return extension; 30 return extension;
31 } 31 }
32 32
33 void RunTest(const std::string& path) { 33 void RunTestWithUrl(const GURL& url) {
34 const extensions::Extension* extension = LoadTestExtension(); 34 const extensions::Extension* extension = LoadTestExtension();
35 ASSERT_TRUE(extension); 35 ASSERT_TRUE(extension);
36 36
37 extensions::ResultCatcher catcher;
38 ui_test_utils::NavigateToURL(browser(), url);
39
40 if (!catcher.GetNextResult())
41 FAIL() << catcher.message();
42 }
43
44 void RunTest(const std::string& path) {
37 ASSERT_TRUE(StartEmbeddedTestServer()); 45 ASSERT_TRUE(StartEmbeddedTestServer());
38 embedded_test_server()->ServeFilesFromDirectory( 46 embedded_test_server()->ServeFilesFromDirectory(
39 test_data_dir_.AppendASCII("mime_handler_view")); 47 test_data_dir_.AppendASCII("mime_handler_view"));
40 48
41 extensions::ResultCatcher catcher; 49 RunTestWithUrl(embedded_test_server()->GetURL("/" + path));
42
43 ui_test_utils::NavigateToURL(browser(),
44 embedded_test_server()->GetURL("/" + path));
45
46 if (!catcher.GetNextResult())
47 FAIL() << catcher.message();
48 } 50 }
49 }; 51 };
50 52
51 IN_PROC_BROWSER_TEST_F(MimeHandlerViewTest, PostMessage) { 53 IN_PROC_BROWSER_TEST_F(MimeHandlerViewTest, PostMessage) {
52 RunTest("test_postmessage.html"); 54 RunTest("test_postmessage.html");
53 } 55 }
54 56
55 IN_PROC_BROWSER_TEST_F(MimeHandlerViewTest, Basic) { 57 IN_PROC_BROWSER_TEST_F(MimeHandlerViewTest, Basic) {
56 RunTest("testBasic.csv"); 58 RunTest("testBasic.csv");
57 } 59 }
58 60
59 IN_PROC_BROWSER_TEST_F(MimeHandlerViewTest, Embedded) { 61 IN_PROC_BROWSER_TEST_F(MimeHandlerViewTest, Embedded) {
60 RunTest("test_embedded.html"); 62 RunTest("test_embedded.html");
61 } 63 }
62 64
63 IN_PROC_BROWSER_TEST_F(MimeHandlerViewTest, Iframe) { 65 IN_PROC_BROWSER_TEST_F(MimeHandlerViewTest, Iframe) {
64 RunTest("test_iframe.html"); 66 RunTest("test_iframe.html");
65 } 67 }
66 68
67 IN_PROC_BROWSER_TEST_F(MimeHandlerViewTest, Abort) { 69 IN_PROC_BROWSER_TEST_F(MimeHandlerViewTest, Abort) {
68 RunTest("testAbort.csv"); 70 RunTest("testAbort.csv");
69 } 71 }
70 72
71 IN_PROC_BROWSER_TEST_F(MimeHandlerViewTest, NonAsciiHeaders) { 73 IN_PROC_BROWSER_TEST_F(MimeHandlerViewTest, NonAsciiHeaders) {
72 RunTest("testNonAsciiHeaders.csv"); 74 RunTest("testNonAsciiHeaders.csv");
73 } 75 }
76
77 IN_PROC_BROWSER_TEST_F(MimeHandlerViewTest, DataUrl) {
78 const char* kDataUrlCsv = "data:text/csv;base64,Y29udGVudCB0byByZWFkCg==";
79 RunTestWithUrl(GURL(kDataUrlCsv));
80 }
81
82 IN_PROC_BROWSER_TEST_F(MimeHandlerViewTest, EmbeddedDataUrlObject) {
83 RunTest("test_embedded_data_url_object.html");
84 }
85
86 IN_PROC_BROWSER_TEST_F(MimeHandlerViewTest, EmbeddedDataUrlEmbed) {
87 RunTest("test_embedded_data_url_embed.html");
88 }
OLDNEW
« no previous file with comments | « content/child/web_url_loader_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698