content/renderer/browser_plugin/browser_plugin_browsertest.cc
// Verify that the 'partition' attribute on the browser plugin is parsed
// correctly.
Verify that the 'partition' attribute on the browser plugin is parsed
correctly.
Verify that the ' partition ' attribute on the browser plugin is parsed correctly .
TEST_F(BrowserPluginTest, PartitionAttribute) {
  std::string html = StringPrintf(kHTMLForPartitionedPluginObject,
                                  content::kBrowserPluginMimeType);
  LoadHTML(html.c_str());
  std::string partition_value = ExecuteScriptAndReturnString(
      "document.getElementById('browserplugin').partition");
  EXPECT_STREQ("someid", partition_value.c_str());
  html = StringPrintf(kHTMLForPartitionedPersistedPluginObject,
                      content::kBrowserPluginMimeType);
  LoadHTML(html.c_str());
  partition_value = ExecuteScriptAndReturnString(
      "document.getElementById('browserplugin').partition");
  EXPECT_STREQ("persist:someid", partition_value.c_str());
  ExecuteJavaScript(
      "try {"
      "  document.getElementById('browserplugin').partition = 'foo';"
      "  document.title = 'success';"
      "} catch (e) { document.title = e.message; }");
  std::string title = ExecuteScriptAndReturnString("document.title");
  EXPECT_STREQ(
      "The object has already navigated, so its partition cannot be changed.",
      title.c_str());
  html = StringPrintf(kHTMLForSourcelessPluginObject,
                      content::kBrowserPluginMimeType);
  LoadHTML(html.c_str());
  ExecuteJavaScript(
      "try {"
      "  document.getElementById('browserplugin').partition = 'persist:';"
      "  document.title = 'success';"
      "} catch (e) { document.title = e.message; }");
  title = ExecuteScriptAndReturnString("document.title");
  EXPECT_STREQ("Invalid partition attribute.", title.c_str());
}
TEST_F ( BrowserPluginTest , PartitionAttribute ) { std :: string html = StringPrintf ( kHTMLForPartitionedPluginObject , content :: kBrowserPluginMimeType ) ; LoadHTML ( html . c_str ( ) ) ; std :: string partition_value = ExecuteScriptAndReturnString ( " " ) ; EXPECT_STREQ ( " " , partition_value . c_str ( ) ) ; html = StringPrintf ( kHTMLForPartitionedPersistedPluginObject , content :: kBrowserPluginMimeType ) ; LoadHTML ( html . c_str ( ) ) ; partition_value = ExecuteScriptAndReturnString ( " " ) ; EXPECT_STREQ ( " " , partition_value . c_str ( ) ) ; ExecuteJavaScript ( " " " " " " " " ) ; std :: string title = ExecuteScriptAndReturnString ( " " ) ; EXPECT_STREQ ( " " , title . c_str ( ) ) ; html = StringPrintf ( kHTMLForSourcelessPluginObject , content :: kBrowserPluginMimeType ) ; LoadHTML ( html . c_str ( ) ) ; ExecuteJavaScript ( " " " " " " " " ) ; title = ExecuteScriptAndReturnString ( " " ) ; EXPECT_STREQ ( " " , title . c_str ( ) ) ; }
Verify that the 'partition' attribute on the browser plugin is parsed
correctly.
Verify that the ' partition ' attribute on the browser plugin is parsed correctly .
// Verify that once HTML has defined a source and partition, we cannot change // the partition anymore. // Load a browser tag without 'src' defined. // Ensure we don't parse just "persist:" string and return exception.