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

Side by Side Diff: chrome/browser/extensions/extension_startup_browsertest.cc

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "chrome/browser/extensions/extension_service.h" 11 #include "chrome/browser/extensions/extension_service.h"
12 #include "chrome/browser/extensions/user_script_master.h" 12 #include "chrome/browser/extensions/user_script_master.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
15 #include "chrome/common/chrome_notification_types.h"
15 #include "chrome/common/chrome_paths.h" 16 #include "chrome/common/chrome_paths.h"
16 #include "chrome/common/chrome_switches.h" 17 #include "chrome/common/chrome_switches.h"
17 #include "chrome/test/in_process_browser_test.h" 18 #include "chrome/test/in_process_browser_test.h"
18 #include "chrome/test/ui_test_utils.h" 19 #include "chrome/test/ui_test_utils.h"
19 #include "content/browser/tab_contents/tab_contents.h" 20 #include "content/browser/tab_contents/tab_contents.h"
20 #include "content/common/notification_details.h" 21 #include "content/common/notification_details.h"
21 #include "content/common/notification_type.h"
22 #include "net/base/net_util.h" 22 #include "net/base/net_util.h"
23 23
24 // This file contains high-level startup tests for the extensions system. We've 24 // This file contains high-level startup tests for the extensions system. We've
25 // had many silly bugs where command line flags did not get propagated correctly 25 // had many silly bugs where command line flags did not get propagated correctly
26 // into the services, so we didn't start correctly. 26 // into the services, so we didn't start correctly.
27 27
28 class ExtensionStartupTestBase : public InProcessBrowserTest { 28 class ExtensionStartupTestBase : public InProcessBrowserTest {
29 public: 29 public:
30 ExtensionStartupTestBase() : enable_extensions_(false) { 30 ExtensionStartupTestBase() : enable_extensions_(false) {
31 num_expected_extensions_ = 3; 31 num_expected_extensions_ = 3;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 if (service->extensions()->at(i)->location() != Extension::COMPONENT) 86 if (service->extensions()->at(i)->location() != Extension::COMPONENT)
87 found_extensions++; 87 found_extensions++;
88 88
89 ASSERT_EQ(static_cast<uint32>(num_expected_extensions), 89 ASSERT_EQ(static_cast<uint32>(num_expected_extensions),
90 static_cast<uint32>(found_extensions)); 90 static_cast<uint32>(found_extensions));
91 ASSERT_EQ(expect_extensions_enabled, service->extensions_enabled()); 91 ASSERT_EQ(expect_extensions_enabled, service->extensions_enabled());
92 92
93 UserScriptMaster* master = browser()->profile()->GetUserScriptMaster(); 93 UserScriptMaster* master = browser()->profile()->GetUserScriptMaster();
94 if (!master->ScriptsReady()) { 94 if (!master->ScriptsReady()) {
95 ui_test_utils::WaitForNotification( 95 ui_test_utils::WaitForNotification(
96 NotificationType::USER_SCRIPTS_UPDATED); 96 chrome::NOTIFICATION_USER_SCRIPTS_UPDATED);
97 } 97 }
98 ASSERT_TRUE(master->ScriptsReady()); 98 ASSERT_TRUE(master->ScriptsReady());
99 } 99 }
100 100
101 void TestInjection(bool expect_css, bool expect_script) { 101 void TestInjection(bool expect_css, bool expect_script) {
102 // Load a page affected by the content script and test to see the effect. 102 // Load a page affected by the content script and test to see the effect.
103 FilePath test_file; 103 FilePath test_file;
104 PathService::Get(chrome::DIR_TEST_DATA, &test_file); 104 PathService::Get(chrome::DIR_TEST_DATA, &test_file);
105 test_file = test_file.AppendASCII("extensions") 105 test_file = test_file.AppendASCII("extensions")
106 .AppendASCII("test_file.html"); 106 .AppendASCII("test_file.html");
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 IN_PROC_BROWSER_TEST_F(ExtensionsStartupTest, MAYBE_NoFileAccess) { 161 IN_PROC_BROWSER_TEST_F(ExtensionsStartupTest, MAYBE_NoFileAccess) {
162 WaitForServicesToStart(num_expected_extensions_, true); 162 WaitForServicesToStart(num_expected_extensions_, true);
163 163
164 ExtensionService* service = browser()->profile()->GetExtensionService(); 164 ExtensionService* service = browser()->profile()->GetExtensionService();
165 for (size_t i = 0; i < service->extensions()->size(); ++i) { 165 for (size_t i = 0; i < service->extensions()->size(); ++i) {
166 if (service->extensions()->at(i)->location() == Extension::COMPONENT) 166 if (service->extensions()->at(i)->location() == Extension::COMPONENT)
167 continue; 167 continue;
168 if (service->AllowFileAccess(service->extensions()->at(i))) { 168 if (service->AllowFileAccess(service->extensions()->at(i))) {
169 service->SetAllowFileAccess(service->extensions()->at(i), false); 169 service->SetAllowFileAccess(service->extensions()->at(i), false);
170 ui_test_utils::WaitForNotification( 170 ui_test_utils::WaitForNotification(
171 NotificationType::USER_SCRIPTS_UPDATED); 171 chrome::NOTIFICATION_USER_SCRIPTS_UPDATED);
172 } 172 }
173 } 173 }
174 174
175 TestInjection(false, false); 175 TestInjection(false, false);
176 } 176 }
177 177
178 // ExtensionsLoadTest 178 // ExtensionsLoadTest
179 // Ensures that we can startup the browser with --load-extension and see them 179 // Ensures that we can startup the browser with --load-extension and see them
180 // run. 180 // run.
181 181
(...skipping 15 matching lines...) Expand all
197 #if defined(OS_LINUX) && defined(ARCH_CPU_64_BITS) 197 #if defined(OS_LINUX) && defined(ARCH_CPU_64_BITS)
198 #define Maybe_Test FLAKY_Test 198 #define Maybe_Test FLAKY_Test
199 #else 199 #else
200 #define Maybe_Test Test 200 #define Maybe_Test Test
201 #endif 201 #endif
202 202
203 IN_PROC_BROWSER_TEST_F(ExtensionsLoadTest, Maybe_Test) { 203 IN_PROC_BROWSER_TEST_F(ExtensionsLoadTest, Maybe_Test) {
204 WaitForServicesToStart(1, true); 204 WaitForServicesToStart(1, true);
205 TestInjection(true, true); 205 TestInjection(true, true);
206 } 206 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service_unittest.cc ('k') | chrome/browser/extensions/extension_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698