Chromium Code Reviews| Index: chrome/browser/magic_iframe_browsertest.cc |
| diff --git a/chrome/browser/magic_iframe_browsertest.cc b/chrome/browser/magic_iframe_browsertest.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b5ac43452838e202b59c637cf02d83b59597c2aa |
| --- /dev/null |
| +++ b/chrome/browser/magic_iframe_browsertest.cc |
| @@ -0,0 +1,58 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "base/command_line.h" |
| +#include "base/file_path.h" |
| +#include "base/file_util.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "base/scoped_temp_dir.h" |
| +#include "base/test/thread_test_helper.h" |
| +#include "base/utf_string_conversions.h" |
| +#include "chrome/browser/ui/browser.h" |
| +#include "chrome/test/base/in_process_browser_test.h" |
| +#include "chrome/test/base/ui_test_utils.h" |
| +#include "chrome/test/testing_profile.h" |
| +#include "content/browser/tab_contents/tab_contents.h" |
| +#include "content/common/content_switches.h" |
| + |
| +class MagicIframeBrowserTest : public InProcessBrowserTest { |
| + public: |
| + MagicIframeBrowserTest() { |
| + EnableDOMAutomation(); |
| + } |
| + |
| + GURL GetTestURL(const char* path) { |
|
Paweł Hajdan Jr.
2011/08/03 16:27:27
nit: Why not just const std::string& ? Or StringPi
|
| + std::string url_path = "files/magic_iframe/"; |
|
Paweł Hajdan Jr.
2011/08/03 16:27:27
This seems to be assuming things about current wor
|
| + url_path.append(path); |
| + return test_server()->GetURL(url_path); |
| + } |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(MagicIframeBrowserTest); |
|
Paweł Hajdan Jr.
2011/08/03 16:27:27
nit: No need for DISALLOW_... for test fixtures. P
|
| +}; |
| + |
| +// This browser test is verifying that reparenting of iframe between different |
| +// pages works as expected, including smooth transfer of resources that are |
| +// still being loaded. |
| + |
| +// Currently broken. See http://crbug.com/55200 |
| +#define MAYBE_TransferIframeCloseWindow DISABLED_TransferIframeCloseWindow |
|
Paweł Hajdan Jr.
2011/08/03 16:27:27
nit: No MAYBE here, just DISABLED below.
Also, I'
|
| + |
| +IN_PROC_BROWSER_TEST_F(MagicIframeBrowserTest, |
| + MAYBE_TransferIframeCloseWindow) { |
| + ASSERT_TRUE(test_server()->Start()); |
| + GURL url(GetTestURL("iframe-reparenting-close-window.html")); |
| + LOG(INFO) << "INFO: \n" |
|
Paweł Hajdan Jr.
2011/08/03 16:27:27
Don't spam the output please. It will not hang bec
|
| + << "If this test does not print some log information and then 'DONE',\n" |
| + << " for example if it hangs forever right after this point or crashes\n" |
| + << " test server - that means the crbug 55200 has regressed."; |
| + ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(), url, 3); |
| + std::string result; |
| + ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( |
| + browser()->GetSelectedTabContents()->render_view_host(), L"", |
| + L"window.domAutomationController.send(getLog())", &result)); |
| + LOG(INFO) << "\nLog: " << result; |
|
Paweł Hajdan Jr.
2011/08/03 16:27:27
Do we always need to print the log or can we do th
|
| + ASSERT_NE(result.find("DONE"), std::string::npos); |
| +} |
| + |
|
Paweł Hajdan Jr.
2011/08/03 16:27:27
nit: redundant empty line?
|
| + |