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 "chrome/browser/extensions/extension_apitest.h" | 5 #include "chrome/browser/extensions/extension_apitest.h" |
6 #include "chrome/browser/extensions/extension_service.h" | 6 #include "chrome/browser/extensions/extension_service.h" |
7 #include "chrome/browser/extensions/extension_web_ui.h" | 7 #include "chrome/browser/extensions/extension_web_ui.h" |
8 #include "chrome/browser/prefs/pref_service.h" | 8 #include "chrome/browser/prefs/pref_service.h" |
9 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 9 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/browser/ui/browser_list.h" | 12 #include "chrome/browser/ui/browser_finder.h" |
13 #include "chrome/common/url_constants.h" | 13 #include "chrome/common/url_constants.h" |
14 #include "chrome/test/base/ui_test_utils.h" | 14 #include "chrome/test/base/ui_test_utils.h" |
15 #include "content/public/browser/navigation_entry.h" | 15 #include "content/public/browser/navigation_entry.h" |
16 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
17 | 17 |
18 using content::WebContents; | 18 using content::WebContents; |
19 | 19 |
20 class ExtensionOverrideTest : public ExtensionApiTest { | 20 class ExtensionOverrideTest : public ExtensionApiTest { |
21 protected: | 21 protected: |
22 bool CheckHistoryOverridesContainsNoDupes() { | 22 bool CheckHistoryOverridesContainsNoDupes() { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 #else | 82 #else |
83 #define MAYBE_OverrideNewtabIncognito OverrideNewtabIncognito | 83 #define MAYBE_OverrideNewtabIncognito OverrideNewtabIncognito |
84 #endif | 84 #endif |
85 IN_PROC_BROWSER_TEST_F(ExtensionOverrideTest, MAYBE_OverrideNewtabIncognito) { | 85 IN_PROC_BROWSER_TEST_F(ExtensionOverrideTest, MAYBE_OverrideNewtabIncognito) { |
86 ASSERT_TRUE(RunExtensionTest("override/newtab")) << message_; | 86 ASSERT_TRUE(RunExtensionTest("override/newtab")) << message_; |
87 | 87 |
88 // Navigate an incognito tab to the new tab page. We should get the actual | 88 // Navigate an incognito tab to the new tab page. We should get the actual |
89 // new tab page because we can't load chrome-extension URLs in incognito. | 89 // new tab page because we can't load chrome-extension URLs in incognito. |
90 ui_test_utils::OpenURLOffTheRecord(browser()->profile(), | 90 ui_test_utils::OpenURLOffTheRecord(browser()->profile(), |
91 GURL("chrome://newtab/")); | 91 GURL("chrome://newtab/")); |
92 Browser* otr_browser = BrowserList::FindTabbedBrowser( | 92 Browser* otr_browser = browser::FindTabbedBrowser( |
93 browser()->profile()->GetOffTheRecordProfile(), false); | 93 browser()->profile()->GetOffTheRecordProfile(), false); |
94 WebContents* tab = otr_browser->GetSelectedWebContents(); | 94 WebContents* tab = otr_browser->GetSelectedWebContents(); |
95 ASSERT_TRUE(tab->GetController().GetActiveEntry()); | 95 ASSERT_TRUE(tab->GetController().GetActiveEntry()); |
96 EXPECT_FALSE(tab->GetController().GetActiveEntry()->GetURL(). | 96 EXPECT_FALSE(tab->GetController().GetActiveEntry()->GetURL(). |
97 SchemeIs(chrome::kExtensionScheme)); | 97 SchemeIs(chrome::kExtensionScheme)); |
98 } | 98 } |
99 | 99 |
100 // Times out consistently on Win, http://crbug.com/45173. | 100 // Times out consistently on Win, http://crbug.com/45173. |
101 #if defined(OS_WIN) | 101 #if defined(OS_WIN) |
102 #define MAYBE_OverrideHistory DISABLED_OverrideHistory | 102 #define MAYBE_OverrideHistory DISABLED_OverrideHistory |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 175 |
176 // Unload the failing version. We should be back to passing now. | 176 // Unload the failing version. We should be back to passing now. |
177 UnloadExtension(extension->id()); | 177 UnloadExtension(extension->id()); |
178 { | 178 { |
179 ResultCatcher catcher; | 179 ResultCatcher catcher; |
180 NavigateToKeyboard(); | 180 NavigateToKeyboard(); |
181 ASSERT_TRUE(catcher.GetNextResult()); | 181 ASSERT_TRUE(catcher.GetNextResult()); |
182 } | 182 } |
183 } | 183 } |
184 #endif | 184 #endif |
OLD | NEW |