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

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

Issue 555633003: Use extensions::ResultCatcher; delete ExtensionApiTest::ResultCatcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 6 years, 3 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
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/browser_action_test_util.h" 5 #include "chrome/browser/extensions/browser_action_test_util.h"
6 #include "chrome/browser/extensions/extension_apitest.h" 6 #include "chrome/browser/extensions/extension_apitest.h"
7 #include "chrome/browser/extensions/extension_service.h" 7 #include "chrome/browser/extensions/extension_service.h"
8 #include "chrome/browser/extensions/extension_test_message_listener.h" 8 #include "chrome/browser/extensions/extension_test_message_listener.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/browser_window.h" 11 #include "chrome/browser/ui/browser_window.h"
12 #include "chrome/browser/ui/tabs/tab_strip_model.h" 12 #include "chrome/browser/ui/tabs/tab_strip_model.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/web_contents.h" 15 #include "content/public/browser/web_contents.h"
16 #include "content/public/test/browser_test_utils.h" 16 #include "content/public/test/browser_test_utils.h"
17 #include "extensions/test/result_catcher.h"
17 #include "net/dns/mock_host_resolver.h" 18 #include "net/dns/mock_host_resolver.h"
18 #include "net/test/embedded_test_server/embedded_test_server.h" 19 #include "net/test/embedded_test_server/embedded_test_server.h"
19 20
20 using content::WebContents; 21 using content::WebContents;
22 using extensions::ResultCatcher;
21 23
22 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, IncognitoNoScript) { 24 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, IncognitoNoScript) {
23 ASSERT_TRUE(StartEmbeddedTestServer()); 25 ASSERT_TRUE(StartEmbeddedTestServer());
24 26
25 // Loads a simple extension which attempts to change the title of every page 27 // Loads a simple extension which attempts to change the title of every page
26 // that loads to "modified". 28 // that loads to "modified".
27 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("incognito") 29 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("incognito")
28 .AppendASCII("content_scripts"))); 30 .AppendASCII("content_scripts")));
29 31
30 // Open incognito window and navigate to test page. 32 // Open incognito window and navigate to test page.
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 // Tests that the APIs in an incognito-enabled split-mode extension work 122 // Tests that the APIs in an incognito-enabled split-mode extension work
121 // properly. 123 // properly.
122 // http://crbug.com/120484 124 // http://crbug.com/120484
123 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_IncognitoSplitMode) { 125 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_IncognitoSplitMode) {
124 host_resolver()->AddRule("*", "127.0.0.1"); 126 host_resolver()->AddRule("*", "127.0.0.1");
125 ASSERT_TRUE(StartEmbeddedTestServer()); 127 ASSERT_TRUE(StartEmbeddedTestServer());
126 128
127 // We need 2 ResultCatchers because we'll be running the same test in both 129 // We need 2 ResultCatchers because we'll be running the same test in both
128 // regular and incognito mode. 130 // regular and incognito mode.
129 ResultCatcher catcher; 131 ResultCatcher catcher;
130 catcher.RestrictToProfile(browser()->profile()); 132 catcher.RestrictToBrowserContext(browser()->profile());
131 ResultCatcher catcher_incognito; 133 ResultCatcher catcher_incognito;
132 catcher_incognito.RestrictToProfile( 134 catcher_incognito.RestrictToBrowserContext(
133 browser()->profile()->GetOffTheRecordProfile()); 135 browser()->profile()->GetOffTheRecordProfile());
134 136
135 ExtensionTestMessageListener listener("waiting", true); 137 ExtensionTestMessageListener listener("waiting", true);
136 ExtensionTestMessageListener listener_incognito("waiting_incognito", true); 138 ExtensionTestMessageListener listener_incognito("waiting_incognito", true);
137 139
138 // Open incognito window and navigate to test page. 140 // Open incognito window and navigate to test page.
139 ui_test_utils::OpenURLOffTheRecord( 141 ui_test_utils::OpenURLOffTheRecord(
140 browser()->profile(), 142 browser()->profile(),
141 embedded_test_server()->GetURL("/extensions/test_file.html")); 143 embedded_test_server()->GetURL("/extensions/test_file.html"));
142 144
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 // Open incognito window and navigate to test page. 199 // Open incognito window and navigate to test page.
198 Browser* incognito_browser = ui_test_utils::OpenURLOffTheRecord( 200 Browser* incognito_browser = ui_test_utils::OpenURLOffTheRecord(
199 browser()->profile(), 201 browser()->profile(),
200 embedded_test_server()->GetURL("/extensions/test_file.html")); 202 embedded_test_server()->GetURL("/extensions/test_file.html"));
201 203
202 // Simulate the incognito's browser action being clicked. 204 // Simulate the incognito's browser action being clicked.
203 BrowserActionTestUtil(incognito_browser).Press(0); 205 BrowserActionTestUtil(incognito_browser).Press(0);
204 206
205 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 207 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
206 } 208 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698