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

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

Issue 1086733002: Ensure tests have an active task runner (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/files/file_path.h" 5 #include "base/files/file_path.h"
6 #include "chrome/browser/extensions/active_install_data.h" 6 #include "chrome/browser/extensions/active_install_data.h"
7 #include "chrome/browser/extensions/install_tracker.h" 7 #include "chrome/browser/extensions/install_tracker.h"
8 #include "chrome/test/base/testing_profile.h" 8 #include "chrome/test/base/testing_profile.h"
9 #include "content/public/test/test_browser_thread_bundle.h"
9 #include "extensions/browser/extension_registry.h" 10 #include "extensions/browser/extension_registry.h"
10 #include "extensions/common/extension.h" 11 #include "extensions/common/extension.h"
11 #include "extensions/common/manifest_constants.h" 12 #include "extensions/common/manifest_constants.h"
12 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
13 14
14 using extensions::ActiveInstallData; 15 using extensions::ActiveInstallData;
15 using extensions::Extension; 16 using extensions::Extension;
16 using extensions::ExtensionRegistry; 17 using extensions::ExtensionRegistry;
17 using extensions::InstallTracker; 18 using extensions::InstallTracker;
18 using extensions::InstallObserver; 19 using extensions::InstallObserver;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 Profile* profile() { return profile_.get(); } 58 Profile* profile() { return profile_.get(); }
58 InstallTracker* tracker() { return tracker_.get(); } 59 InstallTracker* tracker() { return tracker_.get(); }
59 60
60 void VerifyInstallData(const ActiveInstallData& original, 61 void VerifyInstallData(const ActiveInstallData& original,
61 const ActiveInstallData& retrieved) { 62 const ActiveInstallData& retrieved) {
62 EXPECT_EQ(original.extension_id, retrieved.extension_id); 63 EXPECT_EQ(original.extension_id, retrieved.extension_id);
63 EXPECT_EQ(original.is_ephemeral, retrieved.is_ephemeral); 64 EXPECT_EQ(original.is_ephemeral, retrieved.is_ephemeral);
64 EXPECT_EQ(original.percent_downloaded, retrieved.percent_downloaded); 65 EXPECT_EQ(original.percent_downloaded, retrieved.percent_downloaded);
65 } 66 }
66 67
68 content::TestBrowserThreadBundle thread_bundle_;
67 scoped_ptr<TestingProfile> profile_; 69 scoped_ptr<TestingProfile> profile_;
68 scoped_ptr<InstallTracker> tracker_; 70 scoped_ptr<InstallTracker> tracker_;
69 }; 71 };
70 72
71 // Verifies that active installs are registered and deregistered correctly. 73 // Verifies that active installs are registered and deregistered correctly.
72 TEST_F(InstallTrackerTest, AddAndRemoveActiveInstalls) { 74 TEST_F(InstallTrackerTest, AddAndRemoveActiveInstalls) {
73 ActiveInstallData install_data1(kExtensionId1); 75 ActiveInstallData install_data1(kExtensionId1);
74 install_data1.percent_downloaded = 76; 76 install_data1.percent_downloaded = 76;
75 ActiveInstallData install_data2(kExtensionId2); 77 ActiveInstallData install_data2(kExtensionId2);
76 install_data2.is_ephemeral = true; 78 install_data2.is_ephemeral = true;
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // Simulate an extension install. 206 // Simulate an extension install.
205 scoped_refptr<Extension> extension = CreateDummyExtension(kExtensionId1); 207 scoped_refptr<Extension> extension = CreateDummyExtension(kExtensionId1);
206 ASSERT_TRUE(extension.get()); 208 ASSERT_TRUE(extension.get());
207 ExtensionRegistry* registry = ExtensionRegistry::Get(profile()); 209 ExtensionRegistry* registry = ExtensionRegistry::Get(profile());
208 ASSERT_TRUE(registry); 210 ASSERT_TRUE(registry);
209 registry->AddEnabled(extension); 211 registry->AddEnabled(extension);
210 registry->TriggerOnInstalled(extension.get(), false); 212 registry->TriggerOnInstalled(extension.get(), false);
211 213
212 EXPECT_FALSE(tracker_->GetActiveInstall(kExtensionId1)); 214 EXPECT_FALSE(tracker_->GetActiveInstall(kExtensionId1));
213 } 215 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698