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

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

Issue 720633003: Revert of CL 722703002 due to build breakage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revert Created 6 years, 1 month 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 <set> 5 #include <set>
6 6
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "chrome/browser/extensions/extension_browsertest.h" 9 #include "chrome/browser/extensions/extension_browsertest.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
11 #include "chrome/browser/extensions/extension_storage_monitor.h" 11 #include "chrome/browser/extensions/extension_storage_monitor.h"
12 #include "chrome/browser/ui/extensions/app_launch_params.h"
13 #include "chrome/browser/ui/extensions/application_launch.h" 12 #include "chrome/browser/ui/extensions/application_launch.h"
14 #include "content/public/test/test_utils.h" 13 #include "content/public/test/test_utils.h"
15 #include "extensions/browser/extension_prefs.h" 14 #include "extensions/browser/extension_prefs.h"
16 #include "extensions/browser/extension_registry.h" 15 #include "extensions/browser/extension_registry.h"
17 #include "extensions/browser/extension_system.h" 16 #include "extensions/browser/extension_system.h"
18 #include "extensions/browser/test_extension_registry_observer.h" 17 #include "extensions/browser/test_extension_registry_observer.h"
19 #include "extensions/common/constants.h"
20 #include "extensions/test/extension_test_message_listener.h" 18 #include "extensions/test/extension_test_message_listener.h"
21 #include "ui/message_center/message_center.h" 19 #include "ui/message_center/message_center.h"
22 #include "ui/message_center/message_center_observer.h" 20 #include "ui/message_center/message_center_observer.h"
23 21
24 namespace extensions { 22 namespace extensions {
25 23
26 namespace { 24 namespace {
27 25
28 const int kInitialUsageThreshold = 500; 26 const int kInitialUsageThreshold = 500;
29 27
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 // Write a number of bytes to persistent storage. 172 // Write a number of bytes to persistent storage.
175 void WriteBytes(const Extension* extension, 173 void WriteBytes(const Extension* extension,
176 int num_bytes, 174 int num_bytes,
177 bool expected_notification) { 175 bool expected_notification) {
178 ExtensionTestMessageListener launched_listener("launched", true); 176 ExtensionTestMessageListener launched_listener("launched", true);
179 ExtensionTestMessageListener write_complete_listener( 177 ExtensionTestMessageListener write_complete_listener(
180 "write_complete", false); 178 "write_complete", false);
181 NotificationObserver notification_observer( 179 NotificationObserver notification_observer(
182 GetNotificationId(extension->id())); 180 GetNotificationId(extension->id()));
183 181
184 OpenApplication(AppLaunchParams(profile(), extension, LAUNCH_CONTAINER_NONE, 182 OpenApplication(AppLaunchParams(
185 NEW_WINDOW, extensions::SOURCE_UNTRACKED)); 183 profile(), extension, LAUNCH_CONTAINER_NONE, NEW_WINDOW));
186 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); 184 ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
187 185
188 // Instruct the app to write |num_bytes| of data. 186 // Instruct the app to write |num_bytes| of data.
189 launched_listener.Reply(base::IntToString(num_bytes)); 187 launched_listener.Reply(base::IntToString(num_bytes));
190 ASSERT_TRUE(write_complete_listener.WaitUntilSatisfied()); 188 ASSERT_TRUE(write_complete_listener.WaitUntilSatisfied());
191 189
192 if (expected_notification) { 190 if (expected_notification) {
193 EXPECT_TRUE(notification_observer.WaitForNotification()); 191 EXPECT_TRUE(notification_observer.WaitForNotification());
194 } else { 192 } else {
195 base::RunLoop().RunUntilIdle(); 193 base::RunLoop().RunUntilIdle();
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 ExtensionStorageMonitor::BUTTON_UNINSTALL); 331 ExtensionStorageMonitor::BUTTON_UNINSTALL);
334 332
335 // Also fake accepting the uninstall. 333 // Also fake accepting the uninstall.
336 TestExtensionRegistryObserver observer(ExtensionRegistry::Get(profile()), 334 TestExtensionRegistryObserver observer(ExtensionRegistry::Get(profile()),
337 extension->id()); 335 extension->id());
338 SimulateUninstallDialogAccept(); 336 SimulateUninstallDialogAccept();
339 observer.WaitForExtensionUninstalled(); 337 observer.WaitForExtensionUninstalled();
340 } 338 }
341 339
342 } // namespace extensions 340 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_apitest.cc ('k') | chrome/browser/policy/policy_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698