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 "chrome/browser/extensions/extension_browsertest.h" | 5 #include "chrome/browser/extensions/extension_browsertest.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "chrome/browser/extensions/extension_install_prompt.h" | 22 #include "chrome/browser/extensions/extension_install_prompt.h" |
23 #include "chrome/browser/extensions/extension_service.h" | 23 #include "chrome/browser/extensions/extension_service.h" |
24 #include "chrome/browser/extensions/unpacked_installer.h" | 24 #include "chrome/browser/extensions/unpacked_installer.h" |
25 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
26 #include "chrome/browser/ui/browser.h" | 26 #include "chrome/browser/ui/browser.h" |
27 #include "chrome/browser/ui/browser_window.h" | 27 #include "chrome/browser/ui/browser_window.h" |
28 #include "chrome/browser/ui/omnibox/location_bar.h" | 28 #include "chrome/browser/ui/omnibox/location_bar.h" |
29 #include "chrome/common/chrome_notification_types.h" | 29 #include "chrome/common/chrome_notification_types.h" |
30 #include "chrome/common/chrome_paths.h" | 30 #include "chrome/common/chrome_paths.h" |
31 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
32 #include "chrome/common/extensions/features/feature.h" | 32 #include "chrome/common/chrome_version_info.h" |
33 #include "chrome/test/base/ui_test_utils.h" | 33 #include "chrome/test/base/ui_test_utils.h" |
34 #include "content/public/browser/navigation_controller.h" | 34 #include "content/public/browser/navigation_controller.h" |
35 #include "content/public/browser/navigation_entry.h" | 35 #include "content/public/browser/navigation_entry.h" |
36 #include "content/public/browser/notification_registrar.h" | 36 #include "content/public/browser/notification_registrar.h" |
37 #include "content/public/browser/notification_service.h" | 37 #include "content/public/browser/notification_service.h" |
38 #include "content/public/browser/render_view_host.h" | 38 #include "content/public/browser/render_view_host.h" |
39 #include "content/public/test/browser_test_utils.h" | 39 #include "content/public/test/browser_test_utils.h" |
40 | 40 |
41 using extensions::Extension; | 41 using extensions::Extension; |
42 using extensions::ExtensionCreator; | 42 using extensions::ExtensionCreator; |
43 | 43 |
44 ExtensionBrowserTest::ExtensionBrowserTest() | 44 ExtensionBrowserTest::ExtensionBrowserTest() |
45 : loaded_(false), | 45 : loaded_(false), |
46 installed_(false), | 46 installed_(false), |
47 extension_installs_observed_(0), | 47 extension_installs_observed_(0), |
48 extension_load_errors_observed_(0), | 48 extension_load_errors_observed_(0), |
49 target_page_action_count_(-1), | 49 target_page_action_count_(-1), |
50 target_visible_page_action_count_(-1) { | 50 target_visible_page_action_count_(-1) { |
51 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); | 51 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); |
52 AppShortcutManager::SetShortcutCreationDisabledForTesting(true); | 52 AppShortcutManager::SetShortcutCreationDisabledForTesting(true); |
53 } | 53 } |
54 | 54 |
55 ExtensionBrowserTest::~ExtensionBrowserTest() { | 55 ExtensionBrowserTest::~ExtensionBrowserTest() { |
56 AppShortcutManager::SetShortcutCreationDisabledForTesting(false); | 56 AppShortcutManager::SetShortcutCreationDisabledForTesting(false); |
57 } | 57 } |
58 | 58 |
59 void ExtensionBrowserTest::SetUpCommandLine(CommandLine* command_line) { | 59 void ExtensionBrowserTest::SetUpCommandLine(CommandLine* command_line) { |
60 extensions::Feature::SetChannelForTesting( | |
61 chrome::VersionInfo::CHANNEL_UNKNOWN); | |
62 | |
63 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_); | 60 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_); |
64 test_data_dir_ = test_data_dir_.AppendASCII("extensions"); | 61 test_data_dir_ = test_data_dir_.AppendASCII("extensions"); |
65 | 62 |
66 #if defined(OS_CHROMEOS) | 63 #if defined(OS_CHROMEOS) |
67 // This makes sure that we create the Default profile first, with no | 64 // This makes sure that we create the Default profile first, with no |
68 // ExtensionService and then the real profile with one, as we do when | 65 // ExtensionService and then the real profile with one, as we do when |
69 // running on chromeos. | 66 // running on chromeos. |
70 command_line->AppendSwitchASCII(switches::kLoginUser, | 67 command_line->AppendSwitchASCII(switches::kLoginUser, |
71 "TestUser@gmail.com"); | 68 "TestUser@gmail.com"); |
72 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); | 69 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 case content::NOTIFICATION_LOAD_STOP: | 652 case content::NOTIFICATION_LOAD_STOP: |
656 VLOG(1) << "Got LOAD_STOP notification."; | 653 VLOG(1) << "Got LOAD_STOP notification."; |
657 MessageLoopForUI::current()->Quit(); | 654 MessageLoopForUI::current()->Quit(); |
658 break; | 655 break; |
659 | 656 |
660 default: | 657 default: |
661 NOTREACHED(); | 658 NOTREACHED(); |
662 break; | 659 break; |
663 } | 660 } |
664 } | 661 } |
OLD | NEW |