| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/common/extensions/chrome_extensions_client.h" | 5 #include "chrome/common/extensions/chrome_extensions_client.h" |
| 6 | 6 |
| 7 #include <memory> |
| 7 #include <set> | 8 #include <set> |
| 8 #include <string> | 9 #include <string> |
| 9 | 10 |
| 10 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 11 #include "chrome/common/chrome_paths.h" | 12 #include "chrome/common/chrome_paths.h" |
| 12 #include "extensions/common/extension.h" | 13 #include "extensions/common/extension.h" |
| 13 #include "extensions/common/file_util.h" | 14 #include "extensions/common/file_util.h" |
| 14 #include "extensions/common/manifest.h" | 15 #include "extensions/common/manifest.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 17 |
| 17 namespace extensions { | 18 namespace extensions { |
| 18 | 19 |
| 19 class ChromeExtensionsClientTest : public testing::Test { | 20 class ChromeExtensionsClientTest : public testing::Test { |
| 20 public: | 21 public: |
| 21 void SetUp() override { | 22 void SetUp() override { |
| 22 extensions_client_.reset(new ChromeExtensionsClient()); | 23 extensions_client_.reset(new ChromeExtensionsClient()); |
| 23 ExtensionsClient::Set(extensions_client_.get()); | 24 ExtensionsClient::Set(extensions_client_.get()); |
| 24 } | 25 } |
| 25 | 26 |
| 26 private: | 27 private: |
| 27 scoped_ptr<ChromeExtensionsClient> extensions_client_; | 28 std::unique_ptr<ChromeExtensionsClient> extensions_client_; |
| 28 }; | 29 }; |
| 29 | 30 |
| 30 // Test that a browser action extension returns a path to an icon. | 31 // Test that a browser action extension returns a path to an icon. |
| 31 TEST_F(ChromeExtensionsClientTest, GetBrowserImagePaths) { | 32 TEST_F(ChromeExtensionsClientTest, GetBrowserImagePaths) { |
| 32 base::FilePath install_dir; | 33 base::FilePath install_dir; |
| 33 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &install_dir)); | 34 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &install_dir)); |
| 34 install_dir = install_dir.AppendASCII("extensions") | 35 install_dir = install_dir.AppendASCII("extensions") |
| 35 .AppendASCII("api_test") | 36 .AppendASCII("api_test") |
| 36 .AppendASCII("browser_action") | 37 .AppendASCII("browser_action") |
| 37 .AppendASCII("basics"); | 38 .AppendASCII("basics"); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 .AppendASCII("hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"); | 74 .AppendASCII("hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"); |
| 74 | 75 |
| 75 scoped_refptr<Extension> extension3(file_util::LoadExtension( | 76 scoped_refptr<Extension> extension3(file_util::LoadExtension( |
| 76 ext_dir, Manifest::UNPACKED, Extension::NO_FLAGS, &error)); | 77 ext_dir, Manifest::UNPACKED, Extension::NO_FLAGS, &error)); |
| 77 EXPECT_FALSE(extension3.get()); | 78 EXPECT_FALSE(extension3.get()); |
| 78 EXPECT_STREQ("Could not load icon 'icon.png' for page action.", | 79 EXPECT_STREQ("Could not load icon 'icon.png' for page action.", |
| 79 error.c_str()); | 80 error.c_str()); |
| 80 } | 81 } |
| 81 | 82 |
| 82 } // namespace extensions | 83 } // namespace extensions |
| OLD | NEW |