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

Side by Side Diff: chrome/browser/extensions/api/webstore_private/webstore_private_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 <vector> 5 #include <vector>
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "chrome/browser/extensions/api/webstore_private/webstore_private_api.h" 11 #include "chrome/browser/extensions/api/webstore_private/webstore_private_api.h"
12 #include "chrome/browser/extensions/bundle_installer.h" 12 #include "chrome/browser/extensions/bundle_installer.h"
13 #include "chrome/browser/extensions/extension_apitest.h" 13 #include "chrome/browser/extensions/extension_apitest.h"
14 #include "chrome/browser/extensions/extension_function_test_utils.h" 14 #include "chrome/browser/extensions/extension_function_test_utils.h"
15 #include "chrome/browser/extensions/extension_install_prompt.h" 15 #include "chrome/browser/extensions/extension_install_prompt.h"
16 #include "chrome/browser/extensions/extension_install_ui.h" 16 #include "chrome/browser/extensions/extension_install_ui.h"
17 #include "chrome/browser/extensions/extension_service.h" 17 #include "chrome/browser/extensions/extension_service.h"
18 #include "chrome/browser/extensions/webstore_installer.h" 18 #include "chrome/browser/extensions/webstore_installer.h"
19 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/ui/browser.h" 20 #include "chrome/browser/ui/browser.h"
21 #include "chrome/browser/ui/browser_tabstrip.h" 21 #include "chrome/browser/ui/tabs/tab_strip_model.h"
22 #include "chrome/common/chrome_notification_types.h" 22 #include "chrome/common/chrome_notification_types.h"
23 #include "chrome/common/chrome_switches.h" 23 #include "chrome/common/chrome_switches.h"
24 #include "chrome/test/base/test_launcher_utils.h" 24 #include "chrome/test/base/test_launcher_utils.h"
25 #include "chrome/test/base/ui_test_utils.h" 25 #include "chrome/test/base/ui_test_utils.h"
26 #include "content/public/browser/gpu_data_manager.h" 26 #include "content/public/browser/gpu_data_manager.h"
27 #include "content/public/browser/notification_observer.h" 27 #include "content/public/browser/notification_observer.h"
28 #include "content/public/browser/notification_registrar.h" 28 #include "content/public/browser/notification_registrar.h"
29 #include "content/public/common/gpu_info.h" 29 #include "content/public/common/gpu_info.h"
30 #include "content/public/test/browser_test_utils.h" 30 #include "content/public/test/browser_test_utils.h"
31 #include "net/base/mock_host_resolver.h" 31 #include "net/base/mock_host_resolver.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 std::string webgl_status = ""; 248 std::string webgl_status = "";
249 EXPECT_TRUE(value && value->GetAsString(&webgl_status)); 249 EXPECT_TRUE(value && value->GetAsString(&webgl_status));
250 EXPECT_STREQ(webgl_allowed ? kWebGLStatusAllowed : kWebGLStatusBlocked, 250 EXPECT_STREQ(webgl_allowed ? kWebGLStatusAllowed : kWebGLStatusBlocked,
251 webgl_status.c_str()); 251 webgl_status.c_str());
252 } 252 }
253 }; 253 };
254 254
255 // Test cases for webstore origin frame blocking. 255 // Test cases for webstore origin frame blocking.
256 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, 256 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest,
257 FrameWebstorePageBlocked) { 257 FrameWebstorePageBlocked) {
258 content::WebContents* contents = chrome::GetActiveWebContents(browser()); 258 content::WebContents* contents =
259 browser()->tab_strip_model()->GetActiveWebContents();
259 string16 expected_title = UTF8ToUTF16("PASS: about:blank"); 260 string16 expected_title = UTF8ToUTF16("PASS: about:blank");
260 string16 failure_title = UTF8ToUTF16("FAIL"); 261 string16 failure_title = UTF8ToUTF16("FAIL");
261 content::TitleWatcher watcher(contents, expected_title); 262 content::TitleWatcher watcher(contents, expected_title);
262 watcher.AlsoWaitForTitle(failure_title); 263 watcher.AlsoWaitForTitle(failure_title);
263 GURL url = test_server()->GetURL( 264 GURL url = test_server()->GetURL(
264 "files/extensions/api_test/webstore_private/noframe.html"); 265 "files/extensions/api_test/webstore_private/noframe.html");
265 ui_test_utils::NavigateToURL(browser(), url); 266 ui_test_utils::NavigateToURL(browser(), url);
266 string16 final_title = watcher.WaitAndGetTitle(); 267 string16 final_title = watcher.WaitAndGetTitle();
267 EXPECT_EQ(expected_title, final_title); 268 EXPECT_EQ(expected_title, final_title);
268 } 269 }
269 270
270 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, 271 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest,
271 FrameErrorPageBlocked) { 272 FrameErrorPageBlocked) {
272 content::WebContents* contents = chrome::GetActiveWebContents(browser()); 273 content::WebContents* contents =
274 browser()->tab_strip_model()->GetActiveWebContents();
273 string16 expected_title = UTF8ToUTF16("PASS: about:blank"); 275 string16 expected_title = UTF8ToUTF16("PASS: about:blank");
274 string16 failure_title = UTF8ToUTF16("FAIL"); 276 string16 failure_title = UTF8ToUTF16("FAIL");
275 content::TitleWatcher watcher(contents, expected_title); 277 content::TitleWatcher watcher(contents, expected_title);
276 watcher.AlsoWaitForTitle(failure_title); 278 watcher.AlsoWaitForTitle(failure_title);
277 GURL url = test_server()->GetURL( 279 GURL url = test_server()->GetURL(
278 "files/extensions/api_test/webstore_private/noframe2.html"); 280 "files/extensions/api_test/webstore_private/noframe2.html");
279 ui_test_utils::NavigateToURL(browser(), url); 281 ui_test_utils::NavigateToURL(browser(), url);
280 string16 final_title = watcher.WaitAndGetTitle(); 282 string16 final_title = watcher.WaitAndGetTitle();
281 EXPECT_EQ(expected_title, final_title); 283 EXPECT_EQ(expected_title, final_title);
282 } 284 }
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 GpuFeatureType type = 469 GpuFeatureType type =
468 content::GpuDataManager::GetInstance()->GetBlacklistedFeatures(); 470 content::GpuDataManager::GetInstance()->GetBlacklistedFeatures();
469 EXPECT_EQ((type & content::GPU_FEATURE_TYPE_WEBGL), 471 EXPECT_EQ((type & content::GPU_FEATURE_TYPE_WEBGL),
470 content::GPU_FEATURE_TYPE_WEBGL); 472 content::GPU_FEATURE_TYPE_WEBGL);
471 473
472 bool webgl_allowed = false; 474 bool webgl_allowed = false;
473 RunTest(webgl_allowed); 475 RunTest(webgl_allowed);
474 } 476 }
475 477
476 } // namespace extensions 478 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698