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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/memory/singleton.h" | 6 #include "base/memory/singleton.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/test/test_timeouts.h" | 8 #include "base/test/test_timeouts.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "content/browser/browser_plugin/browser_plugin_guest.h" | 10 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 ExecuteSyncJSFunction(rvh, | 915 ExecuteSyncJSFunction(rvh, |
916 ASCIIToUTF16(StringPrintf("PostMessage('%s', true);", kTesting))); | 916 ASCIIToUTF16(StringPrintf("PostMessage('%s', true);", kTesting))); |
917 | 917 |
918 // The title will be updated to "iframe" at the last stage of the | 918 // The title will be updated to "iframe" at the last stage of the |
919 // process described above. | 919 // process described above. |
920 actual_title = iframe_watcher.WaitAndGetTitle(); | 920 actual_title = iframe_watcher.WaitAndGetTitle(); |
921 EXPECT_EQ(ASCIIToUTF16("iframe"), actual_title); | 921 EXPECT_EQ(ASCIIToUTF16("iframe"), actual_title); |
922 } | 922 } |
923 } | 923 } |
924 | 924 |
| 925 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, LoadStop) { |
| 926 const char* kEmbedderURL = "files/browser_plugin_embedder.html"; |
| 927 StartBrowserPluginTest(kEmbedderURL, "about:blank", true, ""); |
| 928 |
| 929 const string16 expected_title = ASCIIToUTF16("loadStop"); |
| 930 content::TitleWatcher title_watcher( |
| 931 test_embedder()->web_contents(), expected_title); |
| 932 // Renavigate the guest to |kHTMLForGuest|. |
| 933 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( |
| 934 test_embedder()->web_contents()->GetRenderViewHost()); |
| 935 ExecuteSyncJSFunction(rvh, ASCIIToUTF16( |
| 936 StringPrintf("SetSrc('%s');", kHTMLForGuest))); |
| 937 |
| 938 string16 actual_title = title_watcher.WaitAndGetTitle(); |
| 939 EXPECT_EQ(expected_title, actual_title); |
| 940 } |
| 941 |
| 942 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, LoadCommit) { |
| 943 const char* kEmbedderURL = "files/browser_plugin_embedder.html"; |
| 944 StartBrowserPluginTest(kEmbedderURL, "about:blank", true, ""); |
| 945 |
| 946 const string16 expected_title = ASCIIToUTF16( |
| 947 StringPrintf("loadCommit:%s", kHTMLForGuest)); |
| 948 content::TitleWatcher title_watcher( |
| 949 test_embedder()->web_contents(), expected_title); |
| 950 // Renavigate the guest to |kHTMLForGuest|. |
| 951 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( |
| 952 test_embedder()->web_contents()->GetRenderViewHost()); |
| 953 ExecuteSyncJSFunction(rvh, ASCIIToUTF16( |
| 954 StringPrintf("SetSrc('%s');", kHTMLForGuest))); |
| 955 |
| 956 string16 actual_title = title_watcher.WaitAndGetTitle(); |
| 957 EXPECT_EQ(expected_title, actual_title); |
| 958 scoped_ptr<base::Value> is_top_level(rvh->ExecuteJavascriptAndGetValue( |
| 959 string16(), ASCIIToUTF16("commitIsTopLevel"))); |
| 960 bool top_level_bool = false; |
| 961 EXPECT_TRUE(is_top_level->GetAsBoolean(&top_level_bool)); |
| 962 EXPECT_EQ(true, top_level_bool); |
| 963 } |
| 964 |
925 } // namespace content | 965 } // namespace content |
OLD | NEW |