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

Side by Side Diff: chrome/browser/background/background_mode_manager_unittest.cc

Issue 1497193002: Remove all the ephemeral apps code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tests Created 5 years 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 (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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/test/test_simple_task_runner.h" 10 #include "base/test/test_simple_task_runner.h"
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 303
304 // From views::MenuModelAdapter::IsCommandEnabled with modification. 304 // From views::MenuModelAdapter::IsCommandEnabled with modification.
305 bool IsCommandEnabled(ui::MenuModel* model, int id) const { 305 bool IsCommandEnabled(ui::MenuModel* model, int id) const {
306 int index = 0; 306 int index = 0;
307 if (ui::MenuModel::GetModelAndIndexForCommandId(id, &model, &index)) 307 if (ui::MenuModel::GetModelAndIndexForCommandId(id, &model, &index))
308 return model->IsEnabledAt(index); 308 return model->IsEnabledAt(index);
309 309
310 return false; 310 return false;
311 } 311 }
312 312
313 void AddEphemeralApp(const extensions::Extension* extension,
314 ExtensionService* service) {
315 extensions::ExtensionPrefs* prefs =
316 extensions::ExtensionPrefs::Get(service->profile());
317 ASSERT_TRUE(prefs);
318 prefs->OnExtensionInstalled(extension,
319 extensions::Extension::ENABLED,
320 syncer::StringOrdinal(),
321 extensions::kInstallFlagIsEphemeral,
322 std::string());
323
324 service->AddExtension(extension);
325 }
326
327 scoped_ptr<TestBackgroundModeManager> manager_; 313 scoped_ptr<TestBackgroundModeManager> manager_;
328 314
329 scoped_ptr<base::CommandLine> command_line_; 315 scoped_ptr<base::CommandLine> command_line_;
330 316
331 scoped_ptr<TestingProfileManager> profile_manager_; 317 scoped_ptr<TestingProfileManager> profile_manager_;
332 // Test profile used by all tests - this is owned by profile_manager_. 318 // Test profile used by all tests - this is owned by profile_manager_.
333 TestingProfile* profile_; 319 TestingProfile* profile_;
334 320
335 private: 321 private:
336 // Required for extension service. 322 // Required for extension service.
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 // When the background mode pref is enabled and there are pending triggers 1017 // When the background mode pref is enabled and there are pending triggers
1032 // they will be registered and the user will be notified. 1018 // they will be registered and the user will be notified.
1033 EXPECT_CALL(manager, EnableLaunchOnStartup(true)); 1019 EXPECT_CALL(manager, EnableLaunchOnStartup(true));
1034 g_browser_process->local_state()->SetBoolean(prefs::kBackgroundModeEnabled, 1020 g_browser_process->local_state()->SetBoolean(prefs::kBackgroundModeEnabled,
1035 true); 1021 true);
1036 Mock::VerifyAndClearExpectations(&manager); 1022 Mock::VerifyAndClearExpectations(&manager);
1037 ASSERT_EQ(1, manager.GetBackgroundClientCountForProfile(profile_)); 1023 ASSERT_EQ(1, manager.GetBackgroundClientCountForProfile(profile_));
1038 AssertBackgroundModeActive(manager); 1024 AssertBackgroundModeActive(manager);
1039 ASSERT_TRUE(manager.HasShownBalloon()); 1025 ASSERT_TRUE(manager.HasShownBalloon());
1040 } 1026 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698