| 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 namespace { | 35 namespace { |
| 36 | 36 |
| 37 struct MockExtensionRegistryObserver : public ExtensionRegistryObserver { | 37 struct MockExtensionRegistryObserver : public ExtensionRegistryObserver { |
| 38 void WaitForInstall() { | 38 void WaitForInstall() { |
| 39 scoped_refptr<content::MessageLoopRunner> runner = | 39 scoped_refptr<content::MessageLoopRunner> runner = |
| 40 new content::MessageLoopRunner; | 40 new content::MessageLoopRunner; |
| 41 quit_closure_ = runner->QuitClosure(); | 41 quit_closure_ = runner->QuitClosure(); |
| 42 runner->Run(); | 42 runner->Run(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 virtual void OnExtensionWillBeInstalled( | 45 void OnExtensionWillBeInstalled(content::BrowserContext* browser_context, |
| 46 content::BrowserContext* browser_context, | 46 const Extension* extension, |
| 47 const Extension* extension, | 47 bool is_update, |
| 48 bool is_update, | 48 bool from_ephemeral, |
| 49 bool from_ephemeral, | 49 const std::string& old_name) override { |
| 50 const std::string& old_name) override { | |
| 51 last_extension_installed = extension->id(); | 50 last_extension_installed = extension->id(); |
| 52 quit_closure_.Run(); | 51 quit_closure_.Run(); |
| 53 } | 52 } |
| 54 | 53 |
| 55 std::string last_extension_installed; | 54 std::string last_extension_installed; |
| 56 base::Closure quit_closure_; | 55 base::Closure quit_closure_; |
| 57 }; | 56 }; |
| 58 | 57 |
| 59 } // namespace | 58 } // namespace |
| 60 | 59 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 RunInstaller("good.zip"); | 127 RunInstaller("good.zip"); |
| 129 } | 128 } |
| 130 | 129 |
| 131 TEST_F(ZipFileInstallerTest, ZipWithPublicKey) { | 130 TEST_F(ZipFileInstallerTest, ZipWithPublicKey) { |
| 132 RunInstaller("public_key.zip"); | 131 RunInstaller("public_key.zip"); |
| 133 const char kIdForPublicKey[] = "ikppjpenhoddphklkpdfdfdabbakkpal"; | 132 const char kIdForPublicKey[] = "ikppjpenhoddphklkpdfdfdabbakkpal"; |
| 134 EXPECT_EQ(observer_.last_extension_installed, kIdForPublicKey); | 133 EXPECT_EQ(observer_.last_extension_installed, kIdForPublicKey); |
| 135 } | 134 } |
| 136 | 135 |
| 137 } // namespace extensions | 136 } // namespace extensions |
| OLD | NEW |