OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <utility> |
| 6 |
5 #include "base/gtest_prod_util.h" | 7 #include "base/gtest_prod_util.h" |
6 #include "base/macros.h" | 8 #include "base/macros.h" |
7 #include "chrome/browser/background/background_mode_manager.h" | 9 #include "chrome/browser/background/background_mode_manager.h" |
8 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/extensions/extension_browsertest.h" | 11 #include "chrome/browser/extensions/extension_browsertest.h" |
10 #include "chrome/browser/profiles/profile_manager.h" | 12 #include "chrome/browser/profiles/profile_manager.h" |
11 | 13 |
12 class TestBackgroundModeManager : public BackgroundModeManager { | 14 class TestBackgroundModeManager : public BackgroundModeManager { |
13 public: | 15 public: |
14 TestBackgroundModeManager(const base::CommandLine& command_line, | 16 TestBackgroundModeManager(const base::CommandLine& command_line, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 48 |
47 // Tests that if we reload a background app, we don't get a popup bubble | 49 // Tests that if we reload a background app, we don't get a popup bubble |
48 // telling us that a new background app has been installed. | 50 // telling us that a new background app has been installed. |
49 IN_PROC_BROWSER_TEST_F(BackgroundAppBrowserTest, ReloadBackgroundApp) { | 51 IN_PROC_BROWSER_TEST_F(BackgroundAppBrowserTest, ReloadBackgroundApp) { |
50 // Pass this in to the browser test. | 52 // Pass this in to the browser test. |
51 scoped_ptr<BackgroundModeManager> test_background_mode_manager( | 53 scoped_ptr<BackgroundModeManager> test_background_mode_manager( |
52 new TestBackgroundModeManager( | 54 new TestBackgroundModeManager( |
53 *base::CommandLine::ForCurrentProcess(), | 55 *base::CommandLine::ForCurrentProcess(), |
54 &(g_browser_process->profile_manager()->GetProfileInfoCache()))); | 56 &(g_browser_process->profile_manager()->GetProfileInfoCache()))); |
55 g_browser_process->set_background_mode_manager_for_test( | 57 g_browser_process->set_background_mode_manager_for_test( |
56 test_background_mode_manager.Pass()); | 58 std::move(test_background_mode_manager)); |
57 TestBackgroundModeManager* manager = | 59 TestBackgroundModeManager* manager = |
58 reinterpret_cast<TestBackgroundModeManager*>( | 60 reinterpret_cast<TestBackgroundModeManager*>( |
59 g_browser_process->background_mode_manager()); | 61 g_browser_process->background_mode_manager()); |
60 | 62 |
61 // Load our background extension | 63 // Load our background extension |
62 ASSERT_FALSE( | 64 ASSERT_FALSE( |
63 manager->showed_background_app_installed_notification_for_test()); | 65 manager->showed_background_app_installed_notification_for_test()); |
64 const extensions::Extension* extension = LoadExtension( | 66 const extensions::Extension* extension = LoadExtension( |
65 test_data_dir_.AppendASCII("background_app")); | 67 test_data_dir_.AppendASCII("background_app")); |
66 ASSERT_FALSE(extension == NULL); | 68 ASSERT_FALSE(extension == NULL); |
67 | 69 |
68 // Set the test flag to not shown. | 70 // Set the test flag to not shown. |
69 manager->set_showed_background_app_installed_notification_for_test(false); | 71 manager->set_showed_background_app_installed_notification_for_test(false); |
70 | 72 |
71 // Reload our background extension | 73 // Reload our background extension |
72 ReloadExtension(extension->id()); | 74 ReloadExtension(extension->id()); |
73 | 75 |
74 // Ensure that we did not see a "Background extension loaded" dialog. | 76 // Ensure that we did not see a "Background extension loaded" dialog. |
75 EXPECT_FALSE( | 77 EXPECT_FALSE( |
76 manager->showed_background_app_installed_notification_for_test()); | 78 manager->showed_background_app_installed_notification_for_test()); |
77 } | 79 } |
OLD | NEW |