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

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

Issue 9834021: Revert most of 128095 (but leave EXPECTs), restoring the AutoUpdate test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/memory/ref_counted.h" 5 #include "base/memory/ref_counted.h"
6 #include "base/stl_util.h" 6 #include "base/stl_util.h"
7 #include "chrome/browser/extensions/autoupdate_interceptor.h" 7 #include "chrome/browser/extensions/autoupdate_interceptor.h"
8 #include "chrome/browser/extensions/extension_browsertest.h" 8 #include "chrome/browser/extensions/extension_browsertest.h"
9 #include "chrome/browser/extensions/extension_host.h" 9 #include "chrome/browser/extensions/extension_host.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 extension = service->GetExtensionById( 256 extension = service->GetExtensionById(
257 "ogjcoiohnmldgjemafoockdghcjciccf", false); 257 "ogjcoiohnmldgjemafoockdghcjciccf", false);
258 ASSERT_TRUE(extension); 258 ASSERT_TRUE(extension);
259 ASSERT_EQ("2.0", extension->VersionString()); 259 ASSERT_EQ("2.0", extension->VersionString());
260 ASSERT_TRUE(notification_listener.started()); 260 ASSERT_TRUE(notification_listener.started());
261 ASSERT_TRUE(notification_listener.finished()); 261 ASSERT_TRUE(notification_listener.finished());
262 ASSERT_TRUE(ContainsKey(notification_listener.updates(), 262 ASSERT_TRUE(ContainsKey(notification_listener.updates(),
263 "ogjcoiohnmldgjemafoockdghcjciccf")); 263 "ogjcoiohnmldgjemafoockdghcjciccf"));
264 notification_listener.Reset(); 264 notification_listener.Reset();
265 265
266 }
267
268 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, AutoUpdateBadKey) {
269 NotificationListener notification_listener;
270 FilePath basedir = test_data_dir_.AppendASCII("autoupdate");
271 // Note: This interceptor gets requests on the IO thread.
272 scoped_refptr<AutoUpdateInterceptor> interceptor(new AutoUpdateInterceptor());
273 content::URLFetcher::SetEnableInterceptionForTests(true);
274
275 // Install version 2 of the extension.
276 ExtensionTestMessageListener listener2("v2 installed", false);
277 ExtensionService* service = browser()->profile()->GetExtensionService();
278 const size_t size_before = service->extensions()->size();
279 ASSERT_TRUE(service->disabled_extensions()->is_empty());
280 const Extension* extension =
281 InstallExtension(basedir.AppendASCII("v2.crx"), 1);
282 ASSERT_TRUE(extension);
283 listener2.WaitUntilSatisfied();
284 ASSERT_EQ(size_before + 1, service->extensions()->size());
285 ASSERT_EQ("ogjcoiohnmldgjemafoockdghcjciccf", extension->id());
286 ASSERT_EQ("2.0", extension->VersionString());
287
288 // Now try doing an update to version 3, which has been incorrectly 266 // Now try doing an update to version 3, which has been incorrectly
289 // signed. This should fail. 267 // signed. This should fail.
290 interceptor->SetResponseOnIOThread("http://localhost/autoupdate/manifest", 268 interceptor->SetResponseOnIOThread("http://localhost/autoupdate/manifest",
291 basedir.AppendASCII("manifest_v3.xml")); 269 basedir.AppendASCII("manifest_v3.xml"));
292 interceptor->SetResponseOnIOThread("http://localhost/autoupdate/v3.crx", 270 interceptor->SetResponseOnIOThread("http://localhost/autoupdate/v3.crx",
293 basedir.AppendASCII("v3.crx")); 271 basedir.AppendASCII("v3.crx"));
294 272
295 service->updater()->CheckNow(); 273 service->updater()->CheckNow();
296 ASSERT_TRUE(WaitForExtensionInstallError()); 274 ASSERT_TRUE(WaitForExtensionInstallError());
297 ASSERT_TRUE(notification_listener.started()); 275 ASSERT_TRUE(notification_listener.started());
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 std::string(kExtensionId) + ";http://localhost/autoupdate/manifest")); 520 std::string(kExtensionId) + ";http://localhost/autoupdate/manifest"));
543 } 521 }
544 ASSERT_TRUE(WaitForExtensionInstall()); 522 ASSERT_TRUE(WaitForExtensionInstall());
545 ASSERT_EQ(size_before + 1, service->extensions()->size()); 523 ASSERT_EQ(size_before + 1, service->extensions()->size());
546 extension = service->GetExtensionById(kExtensionId, false); 524 extension = service->GetExtensionById(kExtensionId, false);
547 ASSERT_TRUE(extension); 525 ASSERT_TRUE(extension);
548 EXPECT_EQ(Extension::EXTERNAL_POLICY_DOWNLOAD, extension->location()); 526 EXPECT_EQ(Extension::EXTERNAL_POLICY_DOWNLOAD, extension->location());
549 EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); 527 EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId));
550 EXPECT_TRUE(service->disabled_extensions()->is_empty()); 528 EXPECT_TRUE(service->disabled_extensions()->is_empty());
551 } 529 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698