Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(487)

Side by Side Diff: chrome/browser/extensions/extension_override_apitest.cc

Issue 12066003: Remove TabStripModel wrapper use. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: gtk Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_tabstrip.h" 12 #include "chrome/browser/ui/tabs/tab_strip_model.h"
13 #include "chrome/common/extensions/manifest_url_handler.h" 13 #include "chrome/common/extensions/manifest_url_handler.h"
14 #include "chrome/common/url_constants.h" 14 #include "chrome/common/url_constants.h"
15 #include "chrome/test/base/ui_test_utils.h" 15 #include "chrome/test/base/ui_test_utils.h"
16 #include "content/public/browser/navigation_entry.h" 16 #include "content/public/browser/navigation_entry.h"
17 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
18 #include "extensions/common/constants.h" 18 #include "extensions/common/constants.h"
19 19
20 using content::WebContents; 20 using content::WebContents;
21 21
22 class ExtensionOverrideTest : public ExtensionApiTest { 22 class ExtensionOverrideTest : public ExtensionApiTest {
(...skipping 24 matching lines...) Expand all
47 } 47 }
48 }; 48 };
49 49
50 IN_PROC_BROWSER_TEST_F(ExtensionOverrideTest, OverrideNewtab) { 50 IN_PROC_BROWSER_TEST_F(ExtensionOverrideTest, OverrideNewtab) {
51 ASSERT_TRUE(RunExtensionTest("override/newtab")) << message_; 51 ASSERT_TRUE(RunExtensionTest("override/newtab")) << message_;
52 { 52 {
53 ResultCatcher catcher; 53 ResultCatcher catcher;
54 // Navigate to the new tab page. The overridden new tab page 54 // Navigate to the new tab page. The overridden new tab page
55 // will call chrome.test.notifyPass() . 55 // will call chrome.test.notifyPass() .
56 ui_test_utils::NavigateToURL(browser(), GURL("chrome://newtab/")); 56 ui_test_utils::NavigateToURL(browser(), GURL("chrome://newtab/"));
57 WebContents* tab = chrome::GetActiveWebContents(browser()); 57 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
58 ASSERT_TRUE(tab->GetController().GetActiveEntry()); 58 ASSERT_TRUE(tab->GetController().GetActiveEntry());
59 EXPECT_TRUE(tab->GetController().GetActiveEntry()->GetURL(). 59 EXPECT_TRUE(tab->GetController().GetActiveEntry()->GetURL().
60 SchemeIs(extensions::kExtensionScheme)); 60 SchemeIs(extensions::kExtensionScheme));
61 61
62 ASSERT_TRUE(catcher.GetNextResult()); 62 ASSERT_TRUE(catcher.GetNextResult());
63 } 63 }
64 64
65 // TODO(erikkay) Load a second extension with the same override. 65 // TODO(erikkay) Load a second extension with the same override.
66 // Verify behavior, then unload the first and verify behavior, etc. 66 // Verify behavior, then unload the first and verify behavior, etc.
67 } 67 }
68 68
69 #if defined(OS_MACOSX) 69 #if defined(OS_MACOSX)
70 // Hangy: http://crbug.com/70511 70 // Hangy: http://crbug.com/70511
71 #define MAYBE_OverrideNewtabIncognito DISABLED_OverrideNewtabIncognito 71 #define MAYBE_OverrideNewtabIncognito DISABLED_OverrideNewtabIncognito
72 #else 72 #else
73 #define MAYBE_OverrideNewtabIncognito OverrideNewtabIncognito 73 #define MAYBE_OverrideNewtabIncognito OverrideNewtabIncognito
74 #endif 74 #endif
75 IN_PROC_BROWSER_TEST_F(ExtensionOverrideTest, MAYBE_OverrideNewtabIncognito) { 75 IN_PROC_BROWSER_TEST_F(ExtensionOverrideTest, MAYBE_OverrideNewtabIncognito) {
76 ASSERT_TRUE(RunExtensionTest("override/newtab")) << message_; 76 ASSERT_TRUE(RunExtensionTest("override/newtab")) << message_;
77 77
78 // Navigate an incognito tab to the new tab page. We should get the actual 78 // Navigate an incognito tab to the new tab page. We should get the actual
79 // new tab page because we can't load chrome-extension URLs in incognito. 79 // new tab page because we can't load chrome-extension URLs in incognito.
80 Browser* otr_browser = ui_test_utils::OpenURLOffTheRecord( 80 Browser* otr_browser = ui_test_utils::OpenURLOffTheRecord(
81 browser()->profile(), GURL("chrome://newtab/")); 81 browser()->profile(), GURL("chrome://newtab/"));
82 WebContents* tab = chrome::GetActiveWebContents(otr_browser); 82 WebContents* tab = otr_browser->tab_strip_model()->GetActiveWebContents();
83 ASSERT_TRUE(tab->GetController().GetActiveEntry()); 83 ASSERT_TRUE(tab->GetController().GetActiveEntry());
84 EXPECT_FALSE(tab->GetController().GetActiveEntry()->GetURL(). 84 EXPECT_FALSE(tab->GetController().GetActiveEntry()->GetURL().
85 SchemeIs(extensions::kExtensionScheme)); 85 SchemeIs(extensions::kExtensionScheme));
86 } 86 }
87 87
88 // Times out consistently on Win, http://crbug.com/45173. 88 // Times out consistently on Win, http://crbug.com/45173.
89 #if defined(OS_WIN) 89 #if defined(OS_WIN)
90 #define MAYBE_OverrideHistory DISABLED_OverrideHistory 90 #define MAYBE_OverrideHistory DISABLED_OverrideHistory
91 #else 91 #else
92 #define MAYBE_OverrideHistory OverrideHistory 92 #define MAYBE_OverrideHistory OverrideHistory
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 ExtensionWebUI::kExtensionURLOverrides); 134 ExtensionWebUI::kExtensionURLOverrides);
135 update.Get()->Set("history", list); 135 update.Get()->Set("history", list);
136 } 136 }
137 137
138 ASSERT_FALSE(CheckHistoryOverridesContainsNoDupes()); 138 ASSERT_FALSE(CheckHistoryOverridesContainsNoDupes());
139 139
140 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("override/history"))); 140 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("override/history")));
141 141
142 ASSERT_TRUE(CheckHistoryOverridesContainsNoDupes()); 142 ASSERT_TRUE(CheckHistoryOverridesContainsNoDupes());
143 } 143 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_nacl_browsertest.cc ('k') | chrome/browser/extensions/extension_startup_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698