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/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
8 #include "chrome/browser/ui/browser_tabstrip.h" | 8 #include "chrome/browser/ui/browser_tabstrip.h" |
9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
10 #include "chrome/test/base/in_process_browser_test.h" | 10 #include "chrome/test/base/in_process_browser_test.h" |
11 #include "chrome/test/base/ui_test_utils.h" | 11 #include "chrome/test/base/ui_test_utils.h" |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 const char kPrefetchPage[] = "files/prerender/simple_prefetch.html"; | 15 const char kPrefetchPage[] = "files/prerender/simple_prefetch.html"; |
16 | 16 |
17 class PrefetchBrowserTestBase : public InProcessBrowserTest { | 17 class PrefetchBrowserTestBase : public InProcessBrowserTest { |
18 public: | 18 public: |
19 explicit PrefetchBrowserTestBase(bool do_prefetching) | 19 explicit PrefetchBrowserTestBase(bool do_prefetching) |
20 : InProcessBrowserTest(), do_prefetching_(do_prefetching) { | 20 : do_prefetching_(do_prefetching) {} |
21 EnableDOMAutomation(); | |
22 } | |
23 | 21 |
24 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 22 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
25 if (do_prefetching_) { | 23 if (do_prefetching_) { |
26 command_line->AppendSwitchASCII( | 24 command_line->AppendSwitchASCII( |
27 switches::kPrerenderMode, | 25 switches::kPrerenderMode, |
28 switches::kPrerenderModeSwitchValuePrefetchOnly); | 26 switches::kPrerenderModeSwitchValuePrefetchOnly); |
29 } else { | 27 } else { |
30 command_line->AppendSwitchASCII( | 28 command_line->AppendSwitchASCII( |
31 switches::kPrerenderMode, | 29 switches::kPrerenderMode, |
32 switches::kPrerenderModeSwitchValueDisabled); | 30 switches::kPrerenderModeSwitchValueDisabled); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 ui_test_utils::TitleWatcher title_watcher( | 68 ui_test_utils::TitleWatcher title_watcher( |
71 chrome::GetActiveWebContents(browser()), | 69 chrome::GetActiveWebContents(browser()), |
72 expected_title); | 70 expected_title); |
73 ui_test_utils::NavigateToURL(browser(), url); | 71 ui_test_utils::NavigateToURL(browser(), url); |
74 | 72 |
75 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | 73 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); |
76 } | 74 } |
77 | 75 |
78 } // namespace | 76 } // namespace |
79 | 77 |
OLD | NEW |