| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/browser_plugin/browser_plugin_browsertest.h" | 5 #include "content/renderer/browser_plugin/browser_plugin_browsertest.h" |
| 6 | 6 |
| 7 #include "base/debug/leak_annotations.h" | 7 #include "base/debug/leak_annotations.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "base/pickle.h" | 11 #include "base/pickle.h" |
| 12 #include "content/public/common/content_constants.h" | 12 #include "content/public/common/content_constants.h" |
| 13 #include "content/public/renderer/content_renderer_client.h" |
| 13 #include "content/renderer/browser_plugin/browser_plugin.h" | 14 #include "content/renderer/browser_plugin/browser_plugin.h" |
| 14 #include "content/renderer/browser_plugin/browser_plugin_manager_factory.h" | 15 #include "content/renderer/browser_plugin/browser_plugin_manager_factory.h" |
| 15 #include "content/renderer/browser_plugin/mock_browser_plugin.h" | 16 #include "content/renderer/browser_plugin/mock_browser_plugin.h" |
| 16 #include "content/renderer/browser_plugin/mock_browser_plugin_manager.h" | 17 #include "content/renderer/browser_plugin/mock_browser_plugin_manager.h" |
| 17 #include "content/renderer/render_thread_impl.h" | 18 #include "content/renderer/render_thread_impl.h" |
| 18 #include "content/renderer/renderer_webkitplatformsupport_impl.h" | 19 #include "content/renderer/renderer_webkitplatformsupport_impl.h" |
| 19 #include "skia/ext/platform_canvas.h" | 20 #include "skia/ext/platform_canvas.h" |
| 20 #include "third_party/WebKit/public/platform/WebCursorInfo.h" | 21 #include "third_party/WebKit/public/platform/WebCursorInfo.h" |
| 21 #include "third_party/WebKit/public/web/WebInputEvent.h" | 22 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 22 #include "third_party/WebKit/public/web/WebScriptSource.h" | 23 #include "third_party/WebKit/public/web/WebScriptSource.h" |
| 23 | 24 |
| 25 namespace content { |
| 26 |
| 24 namespace { | 27 namespace { |
| 25 const char kHTMLForBrowserPluginObject[] = | 28 const char kHTMLForBrowserPluginObject[] = |
| 26 "<object id='browserplugin' width='640px' height='480px'" | 29 "<object id='browserplugin' width='640px' height='480px'" |
| 27 " src='foo' type='%s'></object>" | 30 " src='foo' type='%s'></object>" |
| 28 "<script>document.querySelector('object').nonExistentAttribute;</script>"; | 31 "<script>document.querySelector('object').nonExistentAttribute;</script>"; |
| 29 | 32 |
| 30 const char kHTMLForBrowserPluginWithAllAttributes[] = | 33 const char kHTMLForBrowserPluginWithAllAttributes[] = |
| 31 "<object id='browserplugin' width='640' height='480' type='%s'" | 34 "<object id='browserplugin' width='640' height='480' type='%s'" |
| 32 " autosize maxheight='600' maxwidth='800' minheight='240'" | 35 " autosize maxheight='600' maxwidth='800' minheight='240'" |
| 33 " minwidth='320' name='Jim' partition='someid' src='foo'>"; | 36 " minwidth='320' name='Jim' partition='someid' src='foo'>"; |
| 34 | 37 |
| 35 const char kHTMLForSourcelessPluginObject[] = | 38 const char kHTMLForSourcelessPluginObject[] = |
| 36 "<object id='browserplugin' width='640px' height='480px' type='%s'>"; | 39 "<object id='browserplugin' width='640px' height='480px' type='%s'>"; |
| 37 | 40 |
| 38 const char kHTMLForPartitionedPluginObject[] = | 41 const char kHTMLForPartitionedPluginObject[] = |
| 39 "<object id='browserplugin' width='640px' height='480px'" | 42 "<object id='browserplugin' width='640px' height='480px'" |
| 40 " src='foo' type='%s' partition='someid'>"; | 43 " src='foo' type='%s' partition='someid'>"; |
| 41 | 44 |
| 42 const char kHTMLForInvalidPartitionedPluginObject[] = | 45 const char kHTMLForInvalidPartitionedPluginObject[] = |
| 43 "<object id='browserplugin' width='640px' height='480px'" | 46 "<object id='browserplugin' width='640px' height='480px'" |
| 44 " type='%s' partition='persist:'>"; | 47 " type='%s' partition='persist:'>"; |
| 45 | 48 |
| 46 const char kHTMLForPartitionedPersistedPluginObject[] = | 49 const char kHTMLForPartitionedPersistedPluginObject[] = |
| 47 "<object id='browserplugin' width='640px' height='480px'" | 50 "<object id='browserplugin' width='640px' height='480px'" |
| 48 " src='foo' type='%s' partition='persist:someid'>"; | 51 " src='foo' type='%s' partition='persist:someid'>"; |
| 49 | 52 |
| 50 std::string GetHTMLForBrowserPluginObject() { | 53 std::string GetHTMLForBrowserPluginObject() { |
| 51 return base::StringPrintf(kHTMLForBrowserPluginObject, | 54 return base::StringPrintf(kHTMLForBrowserPluginObject, |
| 52 content::kBrowserPluginMimeType); | 55 kBrowserPluginMimeType); |
| 53 } | 56 } |
| 54 | 57 |
| 55 } // namespace | 58 } // namespace |
| 56 | 59 |
| 57 namespace content { | |
| 58 | |
| 59 class TestContentRendererClient : public ContentRendererClient { | 60 class TestContentRendererClient : public ContentRendererClient { |
| 60 public: | 61 public: |
| 61 TestContentRendererClient() : ContentRendererClient() { | 62 TestContentRendererClient() : ContentRendererClient() { |
| 62 } | 63 } |
| 63 virtual ~TestContentRendererClient() { | 64 virtual ~TestContentRendererClient() { |
| 64 } | 65 } |
| 65 virtual bool AllowBrowserPlugin( | 66 virtual bool AllowBrowserPlugin( |
| 66 blink::WebPluginContainer* container) OVERRIDE { | 67 blink::WebPluginContainer* container) OVERRIDE { |
| 67 // Allow BrowserPlugin for tests. | 68 // Allow BrowserPlugin for tests. |
| 68 return true; | 69 return true; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 91 friend struct DefaultSingletonTraits<TestBrowserPluginManagerFactory>; | 92 friend struct DefaultSingletonTraits<TestBrowserPluginManagerFactory>; |
| 92 | 93 |
| 93 DISALLOW_COPY_AND_ASSIGN(TestBrowserPluginManagerFactory); | 94 DISALLOW_COPY_AND_ASSIGN(TestBrowserPluginManagerFactory); |
| 94 }; | 95 }; |
| 95 | 96 |
| 96 BrowserPluginTest::BrowserPluginTest() {} | 97 BrowserPluginTest::BrowserPluginTest() {} |
| 97 | 98 |
| 98 BrowserPluginTest::~BrowserPluginTest() {} | 99 BrowserPluginTest::~BrowserPluginTest() {} |
| 99 | 100 |
| 100 void BrowserPluginTest::SetUp() { | 101 void BrowserPluginTest::SetUp() { |
| 101 test_content_renderer_client_.reset(new TestContentRendererClient); | |
| 102 SetRendererClientForTesting(test_content_renderer_client_.get()); | |
| 103 BrowserPluginManager::set_factory_for_testing( | 102 BrowserPluginManager::set_factory_for_testing( |
| 104 TestBrowserPluginManagerFactory::GetInstance()); | 103 TestBrowserPluginManagerFactory::GetInstance()); |
| 105 content::RenderViewTest::SetUp(); | 104 content::RenderViewTest::SetUp(); |
| 106 } | 105 } |
| 107 | 106 |
| 108 void BrowserPluginTest::TearDown() { | 107 void BrowserPluginTest::TearDown() { |
| 109 BrowserPluginManager::set_factory_for_testing( | 108 BrowserPluginManager::set_factory_for_testing( |
| 110 TestBrowserPluginManagerFactory::GetInstance()); | 109 TestBrowserPluginManagerFactory::GetInstance()); |
| 111 #if defined(LEAK_SANITIZER) | 110 #if defined(LEAK_SANITIZER) |
| 112 // Do this before shutting down V8 in RenderViewTest::TearDown(). | 111 // Do this before shutting down V8 in RenderViewTest::TearDown(). |
| 113 // http://crbug.com/328552 | 112 // http://crbug.com/328552 |
| 114 __lsan_do_leak_check(); | 113 __lsan_do_leak_check(); |
| 115 #endif | 114 #endif |
| 116 content::RenderViewTest::TearDown(); | 115 RenderViewTest::TearDown(); |
| 117 test_content_renderer_client_.reset(); | 116 } |
| 117 |
| 118 ContentRendererClient* BrowserPluginTest::CreateContentRendererClient() { |
| 119 return new TestContentRendererClient; |
| 118 } | 120 } |
| 119 | 121 |
| 120 std::string BrowserPluginTest::ExecuteScriptAndReturnString( | 122 std::string BrowserPluginTest::ExecuteScriptAndReturnString( |
| 121 const std::string& script) { | 123 const std::string& script) { |
| 122 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); | 124 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); |
| 123 v8::Handle<v8::Value> value = GetMainFrame()->executeScriptAndReturnValue( | 125 v8::Handle<v8::Value> value = GetMainFrame()->executeScriptAndReturnValue( |
| 124 blink::WebScriptSource(blink::WebString::fromUTF8(script.c_str()))); | 126 blink::WebScriptSource(blink::WebString::fromUTF8(script.c_str()))); |
| 125 if (value.IsEmpty() || !value->IsString()) | 127 if (value.IsEmpty() || !value->IsString()) |
| 126 return std::string(); | 128 return std::string(); |
| 127 | 129 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 BrowserPluginMsg_UpdateRect msg(instance_id, update_rect_params); | 221 BrowserPluginMsg_UpdateRect msg(instance_id, update_rect_params); |
| 220 browser_plugin->OnMessageReceived(msg); | 222 browser_plugin->OnMessageReceived(msg); |
| 221 EXPECT_FALSE(browser_plugin->pending_damage_buffer_.get()); | 223 EXPECT_FALSE(browser_plugin->pending_damage_buffer_.get()); |
| 222 } | 224 } |
| 223 | 225 |
| 224 // This test verifies that all attributes (present at the time of writing) are | 226 // This test verifies that all attributes (present at the time of writing) are |
| 225 // parsed on initialization. However, this test does minimal checking of | 227 // parsed on initialization. However, this test does minimal checking of |
| 226 // correct behavior. | 228 // correct behavior. |
| 227 TEST_F(BrowserPluginTest, ParseAllAttributes) { | 229 TEST_F(BrowserPluginTest, ParseAllAttributes) { |
| 228 std::string html = base::StringPrintf(kHTMLForBrowserPluginWithAllAttributes, | 230 std::string html = base::StringPrintf(kHTMLForBrowserPluginWithAllAttributes, |
| 229 content::kBrowserPluginMimeType); | 231 kBrowserPluginMimeType); |
| 230 LoadHTML(html.c_str()); | 232 LoadHTML(html.c_str()); |
| 231 bool result; | 233 bool result; |
| 232 bool has_value = ExecuteScriptAndReturnBool( | 234 bool has_value = ExecuteScriptAndReturnBool( |
| 233 "document.getElementById('browserplugin').autosize", &result); | 235 "document.getElementById('browserplugin').autosize", &result); |
| 234 EXPECT_TRUE(has_value); | 236 EXPECT_TRUE(has_value); |
| 235 EXPECT_TRUE(result); | 237 EXPECT_TRUE(result); |
| 236 int maxHeight = ExecuteScriptAndReturnInt( | 238 int maxHeight = ExecuteScriptAndReturnInt( |
| 237 "document.getElementById('browserplugin').maxheight"); | 239 "document.getElementById('browserplugin').maxheight"); |
| 238 EXPECT_EQ(600, maxHeight); | 240 EXPECT_EQ(600, maxHeight); |
| 239 int maxWidth = ExecuteScriptAndReturnInt( | 241 int maxWidth = ExecuteScriptAndReturnInt( |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 "x.parentNode.removeChild(x);"); | 404 "x.parentNode.removeChild(x);"); |
| 403 ProcessPendingMessages(); | 405 ProcessPendingMessages(); |
| 404 EXPECT_TRUE(browser_plugin_manager()->sink().GetUniqueMessageMatching( | 406 EXPECT_TRUE(browser_plugin_manager()->sink().GetUniqueMessageMatching( |
| 405 BrowserPluginHostMsg_PluginDestroyed::ID)); | 407 BrowserPluginHostMsg_PluginDestroyed::ID)); |
| 406 } | 408 } |
| 407 | 409 |
| 408 // This test verifies that PluginDestroyed messages do not get sent from a | 410 // This test verifies that PluginDestroyed messages do not get sent from a |
| 409 // BrowserPlugin that has never navigated. | 411 // BrowserPlugin that has never navigated. |
| 410 TEST_F(BrowserPluginTest, RemovePluginBeforeNavigation) { | 412 TEST_F(BrowserPluginTest, RemovePluginBeforeNavigation) { |
| 411 std::string html = base::StringPrintf(kHTMLForSourcelessPluginObject, | 413 std::string html = base::StringPrintf(kHTMLForSourcelessPluginObject, |
| 412 content::kBrowserPluginMimeType); | 414 kBrowserPluginMimeType); |
| 413 LoadHTML(html.c_str()); | 415 LoadHTML(html.c_str()); |
| 414 EXPECT_FALSE(browser_plugin_manager()->sink().GetUniqueMessageMatching( | 416 EXPECT_FALSE(browser_plugin_manager()->sink().GetUniqueMessageMatching( |
| 415 BrowserPluginHostMsg_PluginDestroyed::ID)); | 417 BrowserPluginHostMsg_PluginDestroyed::ID)); |
| 416 ExecuteJavaScript("x = document.getElementById('browserplugin'); " | 418 ExecuteJavaScript("x = document.getElementById('browserplugin'); " |
| 417 "x.parentNode.removeChild(x);"); | 419 "x.parentNode.removeChild(x);"); |
| 418 ProcessPendingMessages(); | 420 ProcessPendingMessages(); |
| 419 EXPECT_FALSE(browser_plugin_manager()->sink().GetUniqueMessageMatching( | 421 EXPECT_FALSE(browser_plugin_manager()->sink().GetUniqueMessageMatching( |
| 420 BrowserPluginHostMsg_PluginDestroyed::ID)); | 422 BrowserPluginHostMsg_PluginDestroyed::ID)); |
| 421 } | 423 } |
| 422 | 424 |
| 423 // Verify that the 'partition' attribute on the browser plugin is parsed | 425 // Verify that the 'partition' attribute on the browser plugin is parsed |
| 424 // correctly. | 426 // correctly. |
| 425 TEST_F(BrowserPluginTest, PartitionAttribute) { | 427 TEST_F(BrowserPluginTest, PartitionAttribute) { |
| 426 std::string html = base::StringPrintf(kHTMLForPartitionedPluginObject, | 428 std::string html = base::StringPrintf(kHTMLForPartitionedPluginObject, |
| 427 content::kBrowserPluginMimeType); | 429 kBrowserPluginMimeType); |
| 428 LoadHTML(html.c_str()); | 430 LoadHTML(html.c_str()); |
| 429 std::string partition_value = ExecuteScriptAndReturnString( | 431 std::string partition_value = ExecuteScriptAndReturnString( |
| 430 "document.getElementById('browserplugin').partition"); | 432 "document.getElementById('browserplugin').partition"); |
| 431 EXPECT_STREQ("someid", partition_value.c_str()); | 433 EXPECT_STREQ("someid", partition_value.c_str()); |
| 432 | 434 |
| 433 html = base::StringPrintf(kHTMLForPartitionedPersistedPluginObject, | 435 html = base::StringPrintf(kHTMLForPartitionedPersistedPluginObject, |
| 434 content::kBrowserPluginMimeType); | 436 kBrowserPluginMimeType); |
| 435 LoadHTML(html.c_str()); | 437 LoadHTML(html.c_str()); |
| 436 partition_value = ExecuteScriptAndReturnString( | 438 partition_value = ExecuteScriptAndReturnString( |
| 437 "document.getElementById('browserplugin').partition"); | 439 "document.getElementById('browserplugin').partition"); |
| 438 EXPECT_STREQ("persist:someid", partition_value.c_str()); | 440 EXPECT_STREQ("persist:someid", partition_value.c_str()); |
| 439 | 441 |
| 440 // Verify that once HTML has defined a source and partition, we cannot change | 442 // Verify that once HTML has defined a source and partition, we cannot change |
| 441 // the partition anymore. | 443 // the partition anymore. |
| 442 ExecuteJavaScript( | 444 ExecuteJavaScript( |
| 443 "try {" | 445 "try {" |
| 444 " document.getElementById('browserplugin').partition = 'foo';" | 446 " document.getElementById('browserplugin').partition = 'foo';" |
| 445 " document.title = 'success';" | 447 " document.title = 'success';" |
| 446 "} catch (e) { document.title = e.message; }"); | 448 "} catch (e) { document.title = e.message; }"); |
| 447 std::string title = ExecuteScriptAndReturnString("document.title"); | 449 std::string title = ExecuteScriptAndReturnString("document.title"); |
| 448 EXPECT_STREQ( | 450 EXPECT_STREQ( |
| 449 "The object has already navigated, so its partition cannot be changed.", | 451 "The object has already navigated, so its partition cannot be changed.", |
| 450 title.c_str()); | 452 title.c_str()); |
| 451 | 453 |
| 452 // Load a browser tag without 'src' defined. | 454 // Load a browser tag without 'src' defined. |
| 453 html = base::StringPrintf(kHTMLForSourcelessPluginObject, | 455 html = base::StringPrintf(kHTMLForSourcelessPluginObject, |
| 454 content::kBrowserPluginMimeType); | 456 kBrowserPluginMimeType); |
| 455 LoadHTML(html.c_str()); | 457 LoadHTML(html.c_str()); |
| 456 | 458 |
| 457 // Ensure we don't parse just "persist:" string and return exception. | 459 // Ensure we don't parse just "persist:" string and return exception. |
| 458 ExecuteJavaScript( | 460 ExecuteJavaScript( |
| 459 "try {" | 461 "try {" |
| 460 " document.getElementById('browserplugin').partition = 'persist:';" | 462 " document.getElementById('browserplugin').partition = 'persist:';" |
| 461 " document.title = 'success';" | 463 " document.title = 'success';" |
| 462 "} catch (e) { document.title = e.message; }"); | 464 "} catch (e) { document.title = e.message; }"); |
| 463 title = ExecuteScriptAndReturnString("document.title"); | 465 title = ExecuteScriptAndReturnString("document.title"); |
| 464 EXPECT_STREQ("Invalid partition attribute.", title.c_str()); | 466 EXPECT_STREQ("Invalid partition attribute.", title.c_str()); |
| 465 } | 467 } |
| 466 | 468 |
| 467 // This test verifies that BrowserPlugin enters an error state when the | 469 // This test verifies that BrowserPlugin enters an error state when the |
| 468 // partition attribute is invalid. | 470 // partition attribute is invalid. |
| 469 TEST_F(BrowserPluginTest, InvalidPartition) { | 471 TEST_F(BrowserPluginTest, InvalidPartition) { |
| 470 std::string html = base::StringPrintf(kHTMLForInvalidPartitionedPluginObject, | 472 std::string html = base::StringPrintf(kHTMLForInvalidPartitionedPluginObject, |
| 471 content::kBrowserPluginMimeType); | 473 kBrowserPluginMimeType); |
| 472 LoadHTML(html.c_str()); | 474 LoadHTML(html.c_str()); |
| 473 // Attempt to navigate with an invalid partition. | 475 // Attempt to navigate with an invalid partition. |
| 474 { | 476 { |
| 475 ExecuteJavaScript( | 477 ExecuteJavaScript( |
| 476 "try {" | 478 "try {" |
| 477 " document.getElementById('browserplugin').src = 'bar';" | 479 " document.getElementById('browserplugin').src = 'bar';" |
| 478 " document.title = 'success';" | 480 " document.title = 'success';" |
| 479 "} catch (e) { document.title = e.message; }"); | 481 "} catch (e) { document.title = e.message; }"); |
| 480 std::string title = ExecuteScriptAndReturnString("document.title"); | 482 std::string title = ExecuteScriptAndReturnString("document.title"); |
| 481 EXPECT_STREQ("Invalid partition attribute.", title.c_str()); | 483 EXPECT_STREQ("Invalid partition attribute.", title.c_str()); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 507 ExecuteJavaScript("document.getElementById('browserplugin').src = '42'"); | 509 ExecuteJavaScript("document.getElementById('browserplugin').src = '42'"); |
| 508 EXPECT_EQ("42", ExecuteScriptAndReturnString( | 510 EXPECT_EQ("42", ExecuteScriptAndReturnString( |
| 509 "document.getElementById('browserplugin').src")); | 511 "document.getElementById('browserplugin').src")); |
| 510 } | 512 } |
| 511 } | 513 } |
| 512 | 514 |
| 513 // Test to verify that after the first navigation, the partition attribute | 515 // Test to verify that after the first navigation, the partition attribute |
| 514 // cannot be modified. | 516 // cannot be modified. |
| 515 TEST_F(BrowserPluginTest, ImmutableAttributesAfterNavigation) { | 517 TEST_F(BrowserPluginTest, ImmutableAttributesAfterNavigation) { |
| 516 std::string html = base::StringPrintf(kHTMLForSourcelessPluginObject, | 518 std::string html = base::StringPrintf(kHTMLForSourcelessPluginObject, |
| 517 content::kBrowserPluginMimeType); | 519 kBrowserPluginMimeType); |
| 518 LoadHTML(html.c_str()); | 520 LoadHTML(html.c_str()); |
| 519 | 521 |
| 520 ExecuteJavaScript( | 522 ExecuteJavaScript( |
| 521 "document.getElementById('browserplugin').partition = 'storage'"); | 523 "document.getElementById('browserplugin').partition = 'storage'"); |
| 522 std::string partition_value = ExecuteScriptAndReturnString( | 524 std::string partition_value = ExecuteScriptAndReturnString( |
| 523 "document.getElementById('browserplugin').partition"); | 525 "document.getElementById('browserplugin').partition"); |
| 524 EXPECT_STREQ("storage", partition_value.c_str()); | 526 EXPECT_STREQ("storage", partition_value.c_str()); |
| 525 | 527 |
| 526 std::string src_value = ExecuteScriptAndReturnString( | 528 std::string src_value = ExecuteScriptAndReturnString( |
| 527 "document.getElementById('browserplugin').src"); | 529 "document.getElementById('browserplugin').src"); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 553 "The object has already navigated, so its partition cannot be changed.", | 555 "The object has already navigated, so its partition cannot be changed.", |
| 554 title.c_str()); | 556 title.c_str()); |
| 555 | 557 |
| 556 partition_value = ExecuteScriptAndReturnString( | 558 partition_value = ExecuteScriptAndReturnString( |
| 557 "document.getElementById('browserplugin').partition"); | 559 "document.getElementById('browserplugin').partition"); |
| 558 EXPECT_STREQ("storage", partition_value.c_str()); | 560 EXPECT_STREQ("storage", partition_value.c_str()); |
| 559 } | 561 } |
| 560 | 562 |
| 561 TEST_F(BrowserPluginTest, AutoSizeAttributes) { | 563 TEST_F(BrowserPluginTest, AutoSizeAttributes) { |
| 562 std::string html = base::StringPrintf(kHTMLForSourcelessPluginObject, | 564 std::string html = base::StringPrintf(kHTMLForSourcelessPluginObject, |
| 563 content::kBrowserPluginMimeType); | 565 kBrowserPluginMimeType); |
| 564 LoadHTML(html.c_str()); | 566 LoadHTML(html.c_str()); |
| 565 const char* kSetAutoSizeParametersAndNavigate = | 567 const char* kSetAutoSizeParametersAndNavigate = |
| 566 "var browserplugin = document.getElementById('browserplugin');" | 568 "var browserplugin = document.getElementById('browserplugin');" |
| 567 "browserplugin.autosize = true;" | 569 "browserplugin.autosize = true;" |
| 568 "browserplugin.minwidth = 42;" | 570 "browserplugin.minwidth = 42;" |
| 569 "browserplugin.minheight = 43;" | 571 "browserplugin.minheight = 43;" |
| 570 "browserplugin.maxwidth = 1337;" | 572 "browserplugin.maxwidth = 1337;" |
| 571 "browserplugin.maxheight = 1338;" | 573 "browserplugin.maxheight = 1338;" |
| 572 "browserplugin.src = 'foobar';"; | 574 "browserplugin.src = 'foobar';"; |
| 573 const char* kDisableAutoSize = | 575 const char* kDisableAutoSize = |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 // These value are not populated (as an optimization) if autosize is | 638 // These value are not populated (as an optimization) if autosize is |
| 637 // disabled. | 639 // disabled. |
| 638 EXPECT_EQ(0, auto_size_params.min_size.width()); | 640 EXPECT_EQ(0, auto_size_params.min_size.width()); |
| 639 EXPECT_EQ(0, auto_size_params.min_size.height()); | 641 EXPECT_EQ(0, auto_size_params.min_size.height()); |
| 640 EXPECT_EQ(0, auto_size_params.max_size.width()); | 642 EXPECT_EQ(0, auto_size_params.max_size.width()); |
| 641 EXPECT_EQ(0, auto_size_params.max_size.height()); | 643 EXPECT_EQ(0, auto_size_params.max_size.height()); |
| 642 } | 644 } |
| 643 } | 645 } |
| 644 | 646 |
| 645 } // namespace content | 647 } // namespace content |
| OLD | NEW |