OLD | NEW |
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/macros.h" | 5 #include "base/macros.h" |
6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
7 #include "chrome/browser/extensions/extension_uninstall_dialog.h" | 7 #include "chrome/browser/extensions/extension_uninstall_dialog.h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/browser/ui/browser_window.h" | 9 #include "chrome/browser/ui/browser_window.h" |
10 #include "chrome/test/base/in_process_browser_test.h" | 10 #include "chrome/test/base/in_process_browser_test.h" |
11 #include "content/public/test/test_utils.h" | 11 #include "content/public/test/test_utils.h" |
12 #include "extensions/common/extension.h" | 12 #include "extensions/common/extension.h" |
13 #include "extensions/common/extension_builder.h" | 13 #include "extensions/common/extension_builder.h" |
14 #include "extensions/common/value_builder.h" | 14 #include "extensions/common/value_builder.h" |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 scoped_refptr<extensions::Extension> BuildTestExtension() { | 18 scoped_refptr<extensions::Extension> BuildTestExtension() { |
19 return extensions::ExtensionBuilder() | 19 return extensions::ExtensionBuilder() |
20 .SetManifest(std::move(extensions::DictionaryBuilder() | 20 .SetManifest(extensions::DictionaryBuilder() |
21 .Set("name", "foo") | 21 .Set("name", "foo") |
22 .Set("version", "1.0"))) | 22 .Set("version", "1.0") |
| 23 .Build()) |
23 .Build(); | 24 .Build(); |
24 } | 25 } |
25 | 26 |
26 class TestExtensionUninstallDialogDelegate | 27 class TestExtensionUninstallDialogDelegate |
27 : public extensions::ExtensionUninstallDialog::Delegate { | 28 : public extensions::ExtensionUninstallDialog::Delegate { |
28 public: | 29 public: |
29 explicit TestExtensionUninstallDialogDelegate( | 30 explicit TestExtensionUninstallDialogDelegate( |
30 const base::Closure& quit_closure) | 31 const base::Closure& quit_closure) |
31 : quit_closure_(quit_closure), canceled_(false) {} | 32 : quit_closure_(quit_closure), canceled_(false) {} |
32 | 33 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 &delegate)); | 70 &delegate)); |
70 browser()->window()->Close(); | 71 browser()->window()->Close(); |
71 content::RunAllPendingInMessageLoop(); | 72 content::RunAllPendingInMessageLoop(); |
72 | 73 |
73 dialog->ConfirmUninstall(extension.get(), | 74 dialog->ConfirmUninstall(extension.get(), |
74 extensions::UNINSTALL_REASON_FOR_TESTING, | 75 extensions::UNINSTALL_REASON_FOR_TESTING, |
75 extensions::UNINSTALL_SOURCE_FOR_TESTING); | 76 extensions::UNINSTALL_SOURCE_FOR_TESTING); |
76 run_loop.Run(); | 77 run_loop.Run(); |
77 EXPECT_TRUE(delegate.canceled()); | 78 EXPECT_TRUE(delegate.canceled()); |
78 } | 79 } |
OLD | NEW |