content/renderer/browser_plugin/browser_plugin_browsertest.cc
// Verify that the src attribute on the browser plugin works as expected.
Verify that the src attribute on the browser plugin works as expected.
Verify that the src attribute on the browser plugin works as expected .
TEST_F(BrowserPluginTest, SrcAttribute) {
  LoadHTML(GetHTMLForBrowserPluginObject().c_str());
  {
    const IPC::Message* create_msg =
    browser_plugin_manager()->sink().GetUniqueMessageMatching(
        BrowserPluginHostMsg_CreateGuest::ID);
    ASSERT_TRUE(create_msg);
    const IPC::Message* msg =
    browser_plugin_manager()->sink().GetUniqueMessageMatching(
        BrowserPluginHostMsg_NavigateGuest::ID);
    ASSERT_TRUE(msg);
    int instance_id = 0;
    std::string src;
    BrowserPluginHostMsg_NavigateGuest::Read(msg, &instance_id, &src);
    EXPECT_EQ("foo", src);
  }
  browser_plugin_manager()->sink().ClearMessages();
  ExecuteJavaScript("document.getElementById('browserplugin').src = 'bar'");
  {
    const IPC::Message* create_msg =
    browser_plugin_manager()->sink().GetUniqueMessageMatching(
        BrowserPluginHostMsg_CreateGuest::ID);
    ASSERT_FALSE(create_msg);
    const IPC::Message* msg =
      browser_plugin_manager()->sink().GetUniqueMessageMatching(
          BrowserPluginHostMsg_NavigateGuest::ID);
    ASSERT_TRUE(msg);
    int instance_id = 0;
    std::string src;
    BrowserPluginHostMsg_NavigateGuest::Read(msg, &instance_id, &src);
    EXPECT_EQ("bar", src);
    std::string src_value =
        ExecuteScriptAndReturnString(
            "document.getElementById('browserplugin').src");
    EXPECT_EQ("bar", src_value);
  }
}
TEST_F ( BrowserPluginTest , SrcAttribute ) { LoadHTML ( GetHTMLForBrowserPluginObject ( ) . c_str ( ) ) ; { const IPC :: Message * create_msg = browser_plugin_manager ( ) -> sink ( ) . GetUniqueMessageMatching ( BrowserPluginHostMsg_CreateGuest :: ID ) ; ASSERT_TRUE ( create_msg ) ; const IPC :: Message * msg = browser_plugin_manager ( ) -> sink ( ) . GetUniqueMessageMatching ( BrowserPluginHostMsg_NavigateGuest :: ID ) ; ASSERT_TRUE ( msg ) ; int instance_id = 0 ; std :: string src ; BrowserPluginHostMsg_NavigateGuest :: Read ( msg , & instance_id , & src ) ; EXPECT_EQ ( " " , src ) ; } browser_plugin_manager ( ) -> sink ( ) . ClearMessages ( ) ; ExecuteJavaScript ( " " ) ; { const IPC :: Message * create_msg = browser_plugin_manager ( ) -> sink ( ) . GetUniqueMessageMatching ( BrowserPluginHostMsg_CreateGuest :: ID ) ; ASSERT_FALSE ( create_msg ) ; const IPC :: Message * msg = browser_plugin_manager ( ) -> sink ( ) . GetUniqueMessageMatching ( BrowserPluginHostMsg_NavigateGuest :: ID ) ; ASSERT_TRUE ( msg ) ; int instance_id = 0 ; std :: string src ; BrowserPluginHostMsg_NavigateGuest :: Read ( msg , & instance_id , & src ) ; EXPECT_EQ ( " " , src ) ; std :: string src_value = ExecuteScriptAndReturnString ( " " ) ; EXPECT_EQ ( " " , src_value ) ; } }
Verify that the src attribute on the browser plugin works as expected.
Verify that the src attribute on the browser plugin works as expected .
// Verify that we're reporting the correct URL to navigate to based on the // src attribute. // Ensure we get a CreateGuest on the initial navigation. // Navigate to bar and observe the associated // BrowserPluginHostMsg_NavigateGuest message. // Verify that the src attribute is updated as well. // Verify that we do not get a CreateGuest on subsequent navigations.