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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 ASSERT_TRUE(extension) << message_; | 535 ASSERT_TRUE(extension) << message_; |
536 | 536 |
537 // Test that there is a browser action in the toolbar. | 537 // Test that there is a browser action in the toolbar. |
538 ASSERT_EQ(1, GetBrowserActionsBar()->NumberOfBrowserActions()); | 538 ASSERT_EQ(1, GetBrowserActionsBar()->NumberOfBrowserActions()); |
539 | 539 |
540 // Open an incognito window and test that the browser action isn't there by | 540 // Open an incognito window and test that the browser action isn't there by |
541 // default. | 541 // default. |
542 Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile(); | 542 Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile(); |
543 base::RunLoop().RunUntilIdle(); // Wait for profile initialization. | 543 base::RunLoop().RunUntilIdle(); // Wait for profile initialization. |
544 Browser* incognito_browser = | 544 Browser* incognito_browser = |
545 new Browser(Browser::CreateParams(incognito_profile)); | 545 new Browser(Browser::CreateParams(incognito_profile, true)); |
546 | 546 |
547 ASSERT_EQ(0, | 547 ASSERT_EQ(0, |
548 BrowserActionTestUtil(incognito_browser).NumberOfBrowserActions()); | 548 BrowserActionTestUtil(incognito_browser).NumberOfBrowserActions()); |
549 | 549 |
550 // Now enable the extension in incognito mode, and test that the browser | 550 // Now enable the extension in incognito mode, and test that the browser |
551 // action shows up. | 551 // action shows up. |
552 // SetIsIncognitoEnabled() requires a reload of the extension, so we have to | 552 // SetIsIncognitoEnabled() requires a reload of the extension, so we have to |
553 // wait for it. | 553 // wait for it. |
554 TestExtensionRegistryObserver registry_observer( | 554 TestExtensionRegistryObserver registry_observer( |
555 ExtensionRegistry::Get(profile()), extension->id()); | 555 ExtensionRegistry::Get(profile()), extension->id()); |
(...skipping 13 matching lines...) Expand all Loading... |
569 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, IncognitoSplit) { | 569 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, IncognitoSplit) { |
570 ResultCatcher catcher; | 570 ResultCatcher catcher; |
571 const Extension* extension = LoadExtensionWithFlags( | 571 const Extension* extension = LoadExtensionWithFlags( |
572 test_data_dir_.AppendASCII("browser_action/split_mode"), | 572 test_data_dir_.AppendASCII("browser_action/split_mode"), |
573 kFlagEnableIncognito); | 573 kFlagEnableIncognito); |
574 ASSERT_TRUE(extension) << message_; | 574 ASSERT_TRUE(extension) << message_; |
575 | 575 |
576 // Open an incognito window. | 576 // Open an incognito window. |
577 Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile(); | 577 Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile(); |
578 Browser* incognito_browser = | 578 Browser* incognito_browser = |
579 new Browser(Browser::CreateParams(incognito_profile)); | 579 new Browser(Browser::CreateParams(incognito_profile, true)); |
580 base::RunLoop().RunUntilIdle(); // Wait for profile initialization. | 580 base::RunLoop().RunUntilIdle(); // Wait for profile initialization. |
581 // Navigate just to have a tab in this window, otherwise wonky things happen. | 581 // Navigate just to have a tab in this window, otherwise wonky things happen. |
582 OpenURLOffTheRecord(browser()->profile(), GURL("about:blank")); | 582 OpenURLOffTheRecord(browser()->profile(), GURL("about:blank")); |
583 ASSERT_EQ(1, | 583 ASSERT_EQ(1, |
584 BrowserActionTestUtil(incognito_browser).NumberOfBrowserActions()); | 584 BrowserActionTestUtil(incognito_browser).NumberOfBrowserActions()); |
585 | 585 |
586 // A click in the regular profile should open a tab in the regular profile. | 586 // A click in the regular profile should open a tab in the regular profile. |
587 ExecuteExtensionAction(browser(), extension); | 587 ExecuteExtensionAction(browser(), extension); |
588 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 588 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
589 | 589 |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1040 // The test verification below is applicable only to scenarios where the | 1040 // The test verification below is applicable only to scenarios where the |
1041 // download shelf is supported - on ChromeOS, instead of the download shelf, | 1041 // download shelf is supported - on ChromeOS, instead of the download shelf, |
1042 // there is a download notification in the right-bottom corner of the screen. | 1042 // there is a download notification in the right-bottom corner of the screen. |
1043 #if !defined(OS_CHROMEOS) | 1043 #if !defined(OS_CHROMEOS) |
1044 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); | 1044 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); |
1045 #endif | 1045 #endif |
1046 } | 1046 } |
1047 | 1047 |
1048 } // namespace | 1048 } // namespace |
1049 } // namespace extensions | 1049 } // namespace extensions |
OLD | NEW |