| 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 "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" | 10 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 namespace { | 34 namespace { |
| 35 const char* kSimpleArticlePath = "/dom_distiller/simple_article.html"; | 35 const char* kSimpleArticlePath = "/dom_distiller/simple_article.html"; |
| 36 } // namespace | 36 } // namespace |
| 37 | 37 |
| 38 class DomDistillerTabUtilsBrowserTest : public InProcessBrowserTest { | 38 class DomDistillerTabUtilsBrowserTest : public InProcessBrowserTest { |
| 39 public: | 39 public: |
| 40 void SetUpOnMainThread() override { | 40 void SetUpOnMainThread() override { |
| 41 if (!DistillerJavaScriptWorldIdIsSet()) { | 41 if (!DistillerJavaScriptWorldIdIsSet()) { |
| 42 SetDistillerJavaScriptWorldId(content::ISOLATED_WORLD_ID_CONTENT_END); | 42 SetDistillerJavaScriptWorldId(content::ISOLATED_WORLD_ID_CONTENT_END); |
| 43 } | 43 } |
| 44 InProcessBrowserTest::SetUpOnMainThread(); | |
| 45 } | 44 } |
| 46 | 45 |
| 47 void SetUpCommandLine(base::CommandLine* command_line) override { | 46 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 48 command_line->AppendSwitch(switches::kEnableDomDistiller); | 47 command_line->AppendSwitch(switches::kEnableDomDistiller); |
| 49 } | 48 } |
| 50 }; | 49 }; |
| 51 | 50 |
| 52 // WebContentsMainFrameHelper is used to detect if a distilled page has | 51 // WebContentsMainFrameHelper is used to detect if a distilled page has |
| 53 // finished loading. This is done by checking how many times the title has | 52 // finished loading. This is done by checking how many times the title has |
| 54 // been set rather than using "DidFinishLoad" directly due to the content | 53 // been set rather than using "DidFinishLoad" directly due to the content |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 "document.title")->GetAsString(&page_title); | 172 "document.title")->GetAsString(&page_title); |
| 174 EXPECT_EQ("Test Page Title", page_title); | 173 EXPECT_EQ("Test Page Title", page_title); |
| 175 | 174 |
| 176 content::WebContentsDestroyedWatcher destroyed_watcher( | 175 content::WebContentsDestroyedWatcher destroyed_watcher( |
| 177 destination_web_contents); | 176 destination_web_contents); |
| 178 browser()->tab_strip_model()->CloseWebContentsAt(1, 0); | 177 browser()->tab_strip_model()->CloseWebContentsAt(1, 0); |
| 179 destroyed_watcher.Wait(); | 178 destroyed_watcher.Wait(); |
| 180 } | 179 } |
| 181 | 180 |
| 182 } // namespace dom_distiller | 181 } // namespace dom_distiller |
| OLD | NEW |