| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <string.h> | 5 #include <string.h> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" | 9 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" |
| 10 #include "chrome/browser/dom_distiller/tab_utils.h" | 10 #include "chrome/browser/dom_distiller/tab_utils.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 #if (defined(OS_LINUX) && defined(OS_CHROMEOS)) | 89 #if (defined(OS_LINUX) && defined(OS_CHROMEOS)) |
| 90 #define MAYBE_TestSwapWebContents DISABLED_TestSwapWebContents | 90 #define MAYBE_TestSwapWebContents DISABLED_TestSwapWebContents |
| 91 #else | 91 #else |
| 92 #define MAYBE_TestSwapWebContents TestSwapWebContents | 92 #define MAYBE_TestSwapWebContents TestSwapWebContents |
| 93 #endif | 93 #endif |
| 94 | 94 |
| 95 IN_PROC_BROWSER_TEST_F(DomDistillerTabUtilsBrowserTest, | 95 IN_PROC_BROWSER_TEST_F(DomDistillerTabUtilsBrowserTest, |
| 96 MAYBE_TestSwapWebContents) { | 96 MAYBE_TestSwapWebContents) { |
| 97 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 97 ASSERT_TRUE(embedded_test_server()->Start()); |
| 98 | 98 |
| 99 content::WebContents* initial_web_contents = | 99 content::WebContents* initial_web_contents = |
| 100 browser()->tab_strip_model()->GetActiveWebContents(); | 100 browser()->tab_strip_model()->GetActiveWebContents(); |
| 101 const GURL& article_url = embedded_test_server()->GetURL(kSimpleArticlePath); | 101 const GURL& article_url = embedded_test_server()->GetURL(kSimpleArticlePath); |
| 102 | 102 |
| 103 // This blocks until the navigation has completely finished. | 103 // This blocks until the navigation has completely finished. |
| 104 ui_test_utils::NavigateToURL(browser(), article_url); | 104 ui_test_utils::NavigateToURL(browser(), article_url); |
| 105 | 105 |
| 106 DistillCurrentPageAndView(initial_web_contents); | 106 DistillCurrentPageAndView(initial_web_contents); |
| 107 | 107 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 121 | 121 |
| 122 // Verify the new URL is showing distilled content in a new WebContents. | 122 // Verify the new URL is showing distilled content in a new WebContents. |
| 123 EXPECT_NE(initial_web_contents, after_web_contents); | 123 EXPECT_NE(initial_web_contents, after_web_contents); |
| 124 EXPECT_TRUE( | 124 EXPECT_TRUE( |
| 125 after_web_contents->GetLastCommittedURL().SchemeIs(kDomDistillerScheme)); | 125 after_web_contents->GetLastCommittedURL().SchemeIs(kDomDistillerScheme)); |
| 126 EXPECT_EQ("Test Page Title", page_title); | 126 EXPECT_EQ("Test Page Title", page_title); |
| 127 } | 127 } |
| 128 | 128 |
| 129 IN_PROC_BROWSER_TEST_F(DomDistillerTabUtilsBrowserTest, | 129 IN_PROC_BROWSER_TEST_F(DomDistillerTabUtilsBrowserTest, |
| 130 TestDistillIntoWebContents) { | 130 TestDistillIntoWebContents) { |
| 131 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 131 ASSERT_TRUE(embedded_test_server()->Start()); |
| 132 | 132 |
| 133 content::WebContents* source_web_contents = | 133 content::WebContents* source_web_contents = |
| 134 browser()->tab_strip_model()->GetActiveWebContents(); | 134 browser()->tab_strip_model()->GetActiveWebContents(); |
| 135 const GURL& article_url = embedded_test_server()->GetURL(kSimpleArticlePath); | 135 const GURL& article_url = embedded_test_server()->GetURL(kSimpleArticlePath); |
| 136 | 136 |
| 137 // This blocks until the navigation has completely finished. | 137 // This blocks until the navigation has completely finished. |
| 138 ui_test_utils::NavigateToURL(browser(), article_url); | 138 ui_test_utils::NavigateToURL(browser(), article_url); |
| 139 | 139 |
| 140 // Create destination WebContents. | 140 // Create destination WebContents. |
| 141 content::WebContents::CreateParams create_params( | 141 content::WebContents::CreateParams create_params( |
| (...skipping 30 matching lines...) Expand all Loading... |
| 172 "document.title")->GetAsString(&page_title); | 172 "document.title")->GetAsString(&page_title); |
| 173 EXPECT_EQ("Test Page Title", page_title); | 173 EXPECT_EQ("Test Page Title", page_title); |
| 174 | 174 |
| 175 content::WebContentsDestroyedWatcher destroyed_watcher( | 175 content::WebContentsDestroyedWatcher destroyed_watcher( |
| 176 destination_web_contents); | 176 destination_web_contents); |
| 177 browser()->tab_strip_model()->CloseWebContentsAt(1, 0); | 177 browser()->tab_strip_model()->CloseWebContentsAt(1, 0); |
| 178 destroyed_watcher.Wait(); | 178 destroyed_watcher.Wait(); |
| 179 } | 179 } |
| 180 | 180 |
| 181 } // namespace dom_distiller | 181 } // namespace dom_distiller |
| OLD | NEW |