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 "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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 Browser* incognito_browser = | 477 Browser* incognito_browser = |
478 new Browser(Browser::CreateParams(incognito_profile, | 478 new Browser(Browser::CreateParams(incognito_profile, |
479 browser()->host_desktop_type())); | 479 browser()->host_desktop_type())); |
480 | 480 |
481 ASSERT_EQ(0, | 481 ASSERT_EQ(0, |
482 BrowserActionTestUtil(incognito_browser).NumberOfBrowserActions()); | 482 BrowserActionTestUtil(incognito_browser).NumberOfBrowserActions()); |
483 | 483 |
484 // Now enable the extension in incognito mode, and test that the browser | 484 // Now enable the extension in incognito mode, and test that the browser |
485 // action shows up. Note that we don't update the existing window at the | 485 // action shows up. Note that we don't update the existing window at the |
486 // moment, so we just create a new one. | 486 // moment, so we just create a new one. |
487 extensions::ExtensionSystem::Get(browser()->profile())->extension_service()-> | 487 extensions::ExtensionPrefs::Get(browser()->profile())-> |
488 extension_prefs()->SetIsIncognitoEnabled(extension->id(), true); | 488 SetIsIncognitoEnabled(extension->id(), true); |
489 | 489 |
490 chrome::CloseWindow(incognito_browser); | 490 chrome::CloseWindow(incognito_browser); |
491 incognito_browser = | 491 incognito_browser = |
492 new Browser(Browser::CreateParams(incognito_profile, | 492 new Browser(Browser::CreateParams(incognito_profile, |
493 browser()->host_desktop_type())); | 493 browser()->host_desktop_type())); |
494 ASSERT_EQ(1, | 494 ASSERT_EQ(1, |
495 BrowserActionTestUtil(incognito_browser).NumberOfBrowserActions()); | 495 BrowserActionTestUtil(incognito_browser).NumberOfBrowserActions()); |
496 | 496 |
497 // TODO(mpcomplete): simulate a click and have it do the right thing in | 497 // TODO(mpcomplete): simulate a click and have it do the right thing in |
498 // incognito. | 498 // incognito. |
(...skipping 19 matching lines...) Expand all Loading... |
518 ASSERT_TRUE(extension_a); | 518 ASSERT_TRUE(extension_a); |
519 ASSERT_TRUE(extension_b); | 519 ASSERT_TRUE(extension_b); |
520 ASSERT_TRUE(extension_c); | 520 ASSERT_TRUE(extension_c); |
521 | 521 |
522 // Test that there are 3 browser actions in the toolbar. | 522 // Test that there are 3 browser actions in the toolbar. |
523 ASSERT_EQ(size_before + 3, service->extensions()->size()); | 523 ASSERT_EQ(size_before + 3, service->extensions()->size()); |
524 ASSERT_EQ(3, GetBrowserActionsBar().NumberOfBrowserActions()); | 524 ASSERT_EQ(3, GetBrowserActionsBar().NumberOfBrowserActions()); |
525 | 525 |
526 // Now enable 2 of the extensions in incognito mode, and test that the browser | 526 // Now enable 2 of the extensions in incognito mode, and test that the browser |
527 // actions show up. | 527 // actions show up. |
528 service->extension_prefs()->SetIsIncognitoEnabled(extension_a->id(), true); | 528 extensions::ExtensionPrefs* prefs = |
529 service->extension_prefs()->SetIsIncognitoEnabled(extension_c->id(), true); | 529 extensions::ExtensionPrefs::Get(browser()->profile()); |
| 530 prefs->SetIsIncognitoEnabled(extension_a->id(), true); |
| 531 prefs->SetIsIncognitoEnabled(extension_c->id(), true); |
530 | 532 |
531 Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile(); | 533 Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile(); |
532 Browser* incognito_browser = | 534 Browser* incognito_browser = |
533 new Browser(Browser::CreateParams(incognito_profile, | 535 new Browser(Browser::CreateParams(incognito_profile, |
534 browser()->host_desktop_type())); | 536 browser()->host_desktop_type())); |
535 BrowserActionTestUtil incognito_bar(incognito_browser); | 537 BrowserActionTestUtil incognito_bar(incognito_browser); |
536 | 538 |
537 // Navigate just to have a tab in this window, otherwise wonky things happen. | 539 // Navigate just to have a tab in this window, otherwise wonky things happen. |
538 ui_test_utils::OpenURLOffTheRecord(browser()->profile(), GURL("about:blank")); | 540 ui_test_utils::OpenURLOffTheRecord(browser()->profile(), GURL("about:blank")); |
539 | 541 |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 "backgroundColor);"; | 725 "backgroundColor);"; |
724 std::string result; | 726 std::string result; |
725 const std::string frame_xpath; | 727 const std::string frame_xpath; |
726 EXPECT_TRUE(content::ExecuteScriptInFrameAndExtractString( | 728 EXPECT_TRUE(content::ExecuteScriptInFrameAndExtractString( |
727 tab, frame_xpath, script, &result)); | 729 tab, frame_xpath, script, &result)); |
728 EXPECT_EQ(result, "red"); | 730 EXPECT_EQ(result, "red"); |
729 } | 731 } |
730 | 732 |
731 } // namespace | 733 } // namespace |
732 } // namespace extensions | 734 } // namespace extensions |
OLD | NEW |