OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <map> | 5 #include <map> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #import <EarlGrey/EarlGrey.h> | 8 #import <EarlGrey/EarlGrey.h> |
9 | 9 |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
11 #import "base/test/ios/wait_util.h" | 11 #import "base/test/ios/wait_util.h" |
12 #import "ios/web/public/test/http_server.h" | 12 #import "ios/web/public/test/http_server.h" |
13 #include "ios/web/public/test/http_server_util.h" | 13 #include "ios/web/public/test/http_server_util.h" |
14 #import "ios/web/shell/test/earl_grey/shell_base_test_case.h" | |
15 #import "ios/web/shell/test/earl_grey/shell_earl_grey.h" | 14 #import "ios/web/shell/test/earl_grey/shell_earl_grey.h" |
16 #import "ios/web/shell/test/earl_grey/shell_matchers.h" | 15 #import "ios/web/shell/test/earl_grey/shell_matchers.h" |
| 16 #import "ios/web/shell/test/earl_grey/web_shell_test_case.h" |
17 #include "url/gurl.h" | 17 #include "url/gurl.h" |
18 | 18 |
19 #if !defined(__has_feature) || !__has_feature(objc_arc) | 19 #if !defined(__has_feature) || !__has_feature(objc_arc) |
20 #error "This file requires ARC support." | 20 #error "This file requires ARC support." |
21 #endif | 21 #endif |
22 | 22 |
23 using web::WebViewContainingText; | 23 using web::WebViewContainingText; |
24 using web::WebViewCssSelector; | 24 using web::WebViewCssSelector; |
25 | 25 |
26 namespace { | 26 namespace { |
27 | 27 |
28 // Loads a web page with given content. | 28 // Loads a web page with given content. |
29 void LoadPage(const std::string& page_content) { | 29 void LoadPage(const std::string& page_content) { |
30 const GURL url = web::test::HttpServer::MakeUrl("http://plugin"); | 30 const GURL url = web::test::HttpServer::MakeUrl("http://plugin"); |
31 std::map<GURL, std::string> responses{{url, page_content}}; | 31 std::map<GURL, std::string> responses{{url, page_content}}; |
32 web::test::SetUpSimpleHttpServer(responses); | 32 web::test::SetUpSimpleHttpServer(responses); |
33 [ShellEarlGrey loadURL:url]; | 33 [ShellEarlGrey loadURL:url]; |
34 } | 34 } |
35 | 35 |
36 } // namespace | 36 } // namespace |
37 | 37 |
38 // Plugin placeholder test cases for the web shell. These tests verify that web | 38 // Plugin placeholder test cases for the web shell. These tests verify that web |
39 // page shows a placeholder for unsupported plugins. | 39 // page shows a placeholder for unsupported plugins. |
40 @interface PluginPlaceholderTestCase : ShellBaseTestCase | 40 @interface PluginPlaceholderTestCase : WebShellTestCase |
41 @end | 41 @end |
42 | 42 |
43 @implementation PluginPlaceholderTestCase | 43 @implementation PluginPlaceholderTestCase |
44 | 44 |
45 // Tests that a large <applet> with text fallback is untouched. | 45 // Tests that a large <applet> with text fallback is untouched. |
46 - (void)testPluginPlaceholderAppletFallback { | 46 - (void)testPluginPlaceholderAppletFallback { |
47 const char kPageDescription[] = "Applet, text fallback"; | 47 const char kPageDescription[] = "Applet, text fallback"; |
48 const char kFallbackText[] = "Java? On iOS? C'mon."; | 48 const char kFallbackText[] = "Java? On iOS? C'mon."; |
49 const std::string page = base::StringPrintf( | 49 const std::string page = base::StringPrintf( |
50 "<html><body width='800' height='600'>" | 50 "<html><body width='800' height='600'>" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 LoadPage(page); | 203 LoadPage(page); |
204 | 204 |
205 // Verify that placeholder image is not displayed. | 205 // Verify that placeholder image is not displayed. |
206 [[EarlGrey selectElementWithMatcher:WebViewContainingText(kPageDescription)] | 206 [[EarlGrey selectElementWithMatcher:WebViewContainingText(kPageDescription)] |
207 assertWithMatcher:grey_notNil()]; | 207 assertWithMatcher:grey_notNil()]; |
208 [[EarlGrey selectElementWithMatcher:WebViewCssSelector("img")] | 208 [[EarlGrey selectElementWithMatcher:WebViewCssSelector("img")] |
209 assertWithMatcher:grey_nil()]; | 209 assertWithMatcher:grey_nil()]; |
210 } | 210 } |
211 | 211 |
212 @end | 212 @end |
OLD | NEW |