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

Side by Side Diff: content/renderer/browser_plugin/browser_plugin_browsertest.cc

Issue 11052019: <browser> Make new implementation the default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove flag from chrome://flags, add platform app check for both implementation. Created 8 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « content/public/common/content_switches.cc ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/file_path.h" 7 #include "base/file_path.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "content/common/browser_plugin_messages.h" 10 #include "content/common/browser_plugin_messages.h"
(...skipping 20 matching lines...) Expand all
31 const char kHTMLForPartitionedPluginObject[] = 31 const char kHTMLForPartitionedPluginObject[] =
32 "<object id='browserplugin' width='640px' height='480px'" 32 "<object id='browserplugin' width='640px' height='480px'"
33 " src='foo' type='%s' partition='someid'>"; 33 " src='foo' type='%s' partition='someid'>";
34 34
35 const char kHTMLForPartitionedPersistedPluginObject[] = 35 const char kHTMLForPartitionedPersistedPluginObject[] =
36 "<object id='browserplugin' width='640px' height='480px'" 36 "<object id='browserplugin' width='640px' height='480px'"
37 " src='foo' type='%s' partition='persist:someid'>"; 37 " src='foo' type='%s' partition='persist:someid'>";
38 38
39 std::string GetHTMLForBrowserPluginObject() { 39 std::string GetHTMLForBrowserPluginObject() {
40 return StringPrintf(kHTMLForBrowserPluginObject, 40 return StringPrintf(kHTMLForBrowserPluginObject,
41 content::kBrowserPluginNewMimeType); 41 content::kBrowserPluginMimeType);
42 } 42 }
43 43
44 } // namespace 44 } // namespace
45 45
46 namespace content { 46 namespace content {
47 47
48 BrowserPluginTest::BrowserPluginTest() {} 48 BrowserPluginTest::BrowserPluginTest() {}
49 49
50 BrowserPluginTest::~BrowserPluginTest() {} 50 BrowserPluginTest::~BrowserPluginTest() {}
51 51
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 ExecuteJavaScript(kCallReload); 372 ExecuteJavaScript(kCallReload);
373 EXPECT_TRUE(browser_plugin_manager()->sink().GetUniqueMessageMatching( 373 EXPECT_TRUE(browser_plugin_manager()->sink().GetUniqueMessageMatching(
374 BrowserPluginHostMsg_Reload::ID)); 374 BrowserPluginHostMsg_Reload::ID));
375 } 375 }
376 376
377 377
378 // Verify that the 'partition' attribute on the browser plugin is parsed 378 // Verify that the 'partition' attribute on the browser plugin is parsed
379 // correctly. 379 // correctly.
380 TEST_F(BrowserPluginTest, PartitionAttribute) { 380 TEST_F(BrowserPluginTest, PartitionAttribute) {
381 std::string html = StringPrintf(kHTMLForPartitionedPluginObject, 381 std::string html = StringPrintf(kHTMLForPartitionedPluginObject,
382 content::kBrowserPluginNewMimeType); 382 content::kBrowserPluginMimeType);
383 LoadHTML(html.c_str()); 383 LoadHTML(html.c_str());
384 std::string partition_value = ExecuteScriptAndReturnString( 384 std::string partition_value = ExecuteScriptAndReturnString(
385 "document.getElementById('browserplugin').partition"); 385 "document.getElementById('browserplugin').partition");
386 EXPECT_STREQ("someid", partition_value.c_str()); 386 EXPECT_STREQ("someid", partition_value.c_str());
387 387
388 html = StringPrintf(kHTMLForPartitionedPersistedPluginObject, 388 html = StringPrintf(kHTMLForPartitionedPersistedPluginObject,
389 content::kBrowserPluginNewMimeType); 389 content::kBrowserPluginMimeType);
390 LoadHTML(html.c_str()); 390 LoadHTML(html.c_str());
391 partition_value = ExecuteScriptAndReturnString( 391 partition_value = ExecuteScriptAndReturnString(
392 "document.getElementById('browserplugin').partition"); 392 "document.getElementById('browserplugin').partition");
393 EXPECT_STREQ("persist:someid", partition_value.c_str()); 393 EXPECT_STREQ("persist:someid", partition_value.c_str());
394 394
395 // Verify that once HTML has defined a source and partition, we cannot change 395 // Verify that once HTML has defined a source and partition, we cannot change
396 // the partition anymore. 396 // the partition anymore.
397 ExecuteJavaScript( 397 ExecuteJavaScript(
398 "try {" 398 "try {"
399 " document.getElementById('browserplugin').partition = 'foo';" 399 " document.getElementById('browserplugin').partition = 'foo';"
400 " document.title = 'success';" 400 " document.title = 'success';"
401 "} catch (e) { document.title = e.message; }"); 401 "} catch (e) { document.title = e.message; }");
402 std::string title = ExecuteScriptAndReturnString("document.title"); 402 std::string title = ExecuteScriptAndReturnString("document.title");
403 EXPECT_STREQ( 403 EXPECT_STREQ(
404 "The object has already navigated, so its partition cannot be changed.", 404 "The object has already navigated, so its partition cannot be changed.",
405 title.c_str()); 405 title.c_str());
406 406
407 // Load a browser tag without 'src' defined. 407 // Load a browser tag without 'src' defined.
408 html = StringPrintf(kHTMLForSourcelessPluginObject, 408 html = StringPrintf(kHTMLForSourcelessPluginObject,
409 content::kBrowserPluginNewMimeType); 409 content::kBrowserPluginMimeType);
410 LoadHTML(html.c_str()); 410 LoadHTML(html.c_str());
411 411
412 // Ensure we don't parse just "persist:" string and return exception. 412 // Ensure we don't parse just "persist:" string and return exception.
413 ExecuteJavaScript( 413 ExecuteJavaScript(
414 "try {" 414 "try {"
415 " document.getElementById('browserplugin').partition = 'persist:';" 415 " document.getElementById('browserplugin').partition = 'persist:';"
416 " document.title = 'success';" 416 " document.title = 'success';"
417 "} catch (e) { document.title = e.message; }"); 417 "} catch (e) { document.title = e.message; }");
418 title = ExecuteScriptAndReturnString("document.title"); 418 title = ExecuteScriptAndReturnString("document.title");
419 EXPECT_STREQ("Invalid empty partition attribute.", title.c_str()); 419 EXPECT_STREQ("Invalid empty partition attribute.", title.c_str());
420 } 420 }
421 421
422 // Test to verify that after the first navigation, the partition attribute 422 // Test to verify that after the first navigation, the partition attribute
423 // cannot be modified. 423 // cannot be modified.
424 TEST_F(BrowserPluginTest, ImmutableAttributesAfterNavigation) { 424 TEST_F(BrowserPluginTest, ImmutableAttributesAfterNavigation) {
425 std::string html = StringPrintf(kHTMLForSourcelessPluginObject, 425 std::string html = StringPrintf(kHTMLForSourcelessPluginObject,
426 content::kBrowserPluginNewMimeType); 426 content::kBrowserPluginMimeType);
427 LoadHTML(html.c_str()); 427 LoadHTML(html.c_str());
428 428
429 ExecuteJavaScript( 429 ExecuteJavaScript(
430 "document.getElementById('browserplugin').partition = 'storage'"); 430 "document.getElementById('browserplugin').partition = 'storage'");
431 std::string partition_value = ExecuteScriptAndReturnString( 431 std::string partition_value = ExecuteScriptAndReturnString(
432 "document.getElementById('browserplugin').partition"); 432 "document.getElementById('browserplugin').partition");
433 EXPECT_STREQ("storage", partition_value.c_str()); 433 EXPECT_STREQ("storage", partition_value.c_str());
434 434
435 std::string src_value = ExecuteScriptAndReturnString( 435 std::string src_value = ExecuteScriptAndReturnString(
436 "document.getElementById('browserplugin').src"); 436 "document.getElementById('browserplugin').src");
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 EXPECT_STREQ( 483 EXPECT_STREQ(
484 "The object has already navigated, so its partition cannot be changed.", 484 "The object has already navigated, so its partition cannot be changed.",
485 title.c_str()); 485 title.c_str());
486 486
487 partition_value = ExecuteScriptAndReturnString( 487 partition_value = ExecuteScriptAndReturnString(
488 "document.getElementById('browserplugin').partition"); 488 "document.getElementById('browserplugin').partition");
489 EXPECT_STREQ("storage", partition_value.c_str()); 489 EXPECT_STREQ("storage", partition_value.c_str());
490 } 490 }
491 491
492 } // namespace content 492 } // namespace content
OLDNEW
« no previous file with comments | « content/public/common/content_switches.cc ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698