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

Side by Side Diff: chrome/browser/extensions/api/extension_action/browser_action_apitest.cc

Issue 10692195: Consolidate Browser Creation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if defined(TOOLKIT_GTK) 7 #if defined(TOOLKIT_GTK)
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #endif 9 #endif
10 10
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 ASSERT_TRUE(RunExtensionTest("browser_action/basics")) << message_; 288 ASSERT_TRUE(RunExtensionTest("browser_action/basics")) << message_;
289 const Extension* extension = GetSingleLoadedExtension(); 289 const Extension* extension = GetSingleLoadedExtension();
290 ASSERT_TRUE(extension) << message_; 290 ASSERT_TRUE(extension) << message_;
291 291
292 // Test that there is a browser action in the toolbar. 292 // Test that there is a browser action in the toolbar.
293 ASSERT_EQ(1, GetBrowserActionsBar().NumberOfBrowserActions()); 293 ASSERT_EQ(1, GetBrowserActionsBar().NumberOfBrowserActions());
294 294
295 // Open an incognito window and test that the browser action isn't there by 295 // Open an incognito window and test that the browser action isn't there by
296 // default. 296 // default.
297 Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile(); 297 Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile();
298 Browser* incognito_browser = Browser::Create(incognito_profile); 298 Browser* incognito_browser =
299 new Browser(Browser::CreateParams(incognito_profile));
299 300
300 ASSERT_EQ(0, 301 ASSERT_EQ(0,
301 BrowserActionTestUtil(incognito_browser).NumberOfBrowserActions()); 302 BrowserActionTestUtil(incognito_browser).NumberOfBrowserActions());
302 303
303 // Now enable the extension in incognito mode, and test that the browser 304 // Now enable the extension in incognito mode, and test that the browser
304 // action shows up. Note that we don't update the existing window at the 305 // action shows up. Note that we don't update the existing window at the
305 // moment, so we just create a new one. 306 // moment, so we just create a new one.
306 browser()->profile()->GetExtensionService()->extension_prefs()-> 307 browser()->profile()->GetExtensionService()->extension_prefs()->
307 SetIsIncognitoEnabled(extension->id(), true); 308 SetIsIncognitoEnabled(extension->id(), true);
308 309
309 chrome::CloseWindow(incognito_browser); 310 chrome::CloseWindow(incognito_browser);
310 incognito_browser = Browser::Create(incognito_profile); 311 incognito_browser = new Browser(Browser::CreateParams(incognito_profile));
311 ASSERT_EQ(1, 312 ASSERT_EQ(1,
312 BrowserActionTestUtil(incognito_browser).NumberOfBrowserActions()); 313 BrowserActionTestUtil(incognito_browser).NumberOfBrowserActions());
313 314
314 // TODO(mpcomplete): simulate a click and have it do the right thing in 315 // TODO(mpcomplete): simulate a click and have it do the right thing in
315 // incognito. 316 // incognito.
316 } 317 }
317 318
318 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, IncognitoDragging) { 319 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, IncognitoDragging) {
319 ExtensionService* service = browser()->profile()->GetExtensionService(); 320 ExtensionService* service = browser()->profile()->GetExtensionService();
320 321
(...skipping 17 matching lines...) Expand all
338 // Test that there are 3 browser actions in the toolbar. 339 // Test that there are 3 browser actions in the toolbar.
339 ASSERT_EQ(size_before + 3, service->extensions()->size()); 340 ASSERT_EQ(size_before + 3, service->extensions()->size());
340 ASSERT_EQ(3, GetBrowserActionsBar().NumberOfBrowserActions()); 341 ASSERT_EQ(3, GetBrowserActionsBar().NumberOfBrowserActions());
341 342
342 // Now enable 2 of the extensions in incognito mode, and test that the browser 343 // Now enable 2 of the extensions in incognito mode, and test that the browser
343 // actions show up. 344 // actions show up.
344 service->extension_prefs()->SetIsIncognitoEnabled(extension_a->id(), true); 345 service->extension_prefs()->SetIsIncognitoEnabled(extension_a->id(), true);
345 service->extension_prefs()->SetIsIncognitoEnabled(extension_c->id(), true); 346 service->extension_prefs()->SetIsIncognitoEnabled(extension_c->id(), true);
346 347
347 Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile(); 348 Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile();
348 Browser* incognito_browser = Browser::Create(incognito_profile); 349 Browser* incognito_browser =
350 new Browser(Browser::CreateParams(incognito_profile));
349 BrowserActionTestUtil incognito_bar(incognito_browser); 351 BrowserActionTestUtil incognito_bar(incognito_browser);
350 352
351 // Navigate just to have a tab in this window, otherwise wonky things happen. 353 // Navigate just to have a tab in this window, otherwise wonky things happen.
352 ui_test_utils::OpenURLOffTheRecord(browser()->profile(), GURL("about:blank")); 354 ui_test_utils::OpenURLOffTheRecord(browser()->profile(), GURL("about:blank"));
353 355
354 ASSERT_EQ(2, incognito_bar.NumberOfBrowserActions()); 356 ASSERT_EQ(2, incognito_bar.NumberOfBrowserActions());
355 357
356 // Ensure that the browser actions are in the right order (ABC). 358 // Ensure that the browser actions are in the right order (ABC).
357 EXPECT_EQ(kTooltipA, GetBrowserActionsBar().GetTooltip(0)); 359 EXPECT_EQ(kTooltipA, GetBrowserActionsBar().GetTooltip(0));
358 EXPECT_EQ(kTooltipB, GetBrowserActionsBar().GetTooltip(1)); 360 EXPECT_EQ(kTooltipB, GetBrowserActionsBar().GetTooltip(1));
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 ResultCatcher catcher; 464 ResultCatcher catcher;
463 ui_test_utils::NavigateToURL(browser(), 465 ui_test_utils::NavigateToURL(browser(),
464 GURL(extension->GetResourceURL("update.html"))); 466 GURL(extension->GetResourceURL("update.html")));
465 ASSERT_TRUE(catcher.GetNextResult()); 467 ASSERT_TRUE(catcher.GetNextResult());
466 468
467 // Test the getters for a specific tab. 469 // Test the getters for a specific tab.
468 ui_test_utils::NavigateToURL(browser(), 470 ui_test_utils::NavigateToURL(browser(),
469 GURL(extension->GetResourceURL("update2.html"))); 471 GURL(extension->GetResourceURL("update2.html")));
470 ASSERT_TRUE(catcher.GetNextResult()); 472 ASSERT_TRUE(catcher.GetNextResult());
471 } 473 }
OLDNEW
« no previous file with comments | « chrome/browser/debugger/devtools_window.cc ('k') | chrome/browser/extensions/api/identity/identity_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698