| 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/browser/component_updater/flash_component_installer.h" | 5 #include "chrome/browser/component_updater/flash_component_installer.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/json/json_file_value_serializer.h" | 9 #include "base/json/json_file_value_serializer.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "base/version.h" | 13 #include "base/version.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "chrome/common/chrome_paths.h" | 15 #include "chrome/common/chrome_paths.h" |
| 16 #include "content/public/test/test_browser_thread.h" | 16 #include "content/public/test/test_browser_thread.h" |
| 17 #include "ppapi/shared_impl/test_globals.h" | 17 #include "ppapi/shared_impl/test_globals.h" |
| 18 | 18 |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 20 | 20 |
| 21 using content::BrowserThread; | 21 using content::BrowserThread; |
| 22 | 22 |
| 23 namespace component_updater { | 23 namespace component_updater { |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 // File name of the Pepper Flash plugin on different platforms. | 26 // File name of the Pepper Flash plugin on different platforms. |
| 27 const base::FilePath::CharType kDataPath[] = | 27 const base::FilePath::CharType kDataPath[] = |
| 28 #if defined(OS_MACOSX) | 28 #if defined(OS_MACOSX) |
| 29 #if defined(ARCH_CPU_X86) |
| 29 FILE_PATH_LITERAL("components/flapper/mac"); | 30 FILE_PATH_LITERAL("components/flapper/mac"); |
| 31 #elif defined(ARCH_CPU_X86_64) |
| 32 FILE_PATH_LITERAL("components/flapper/mac_x64"); |
| 33 #else |
| 34 FILE_PATH_LITERAL("components/flapper/NONEXISTENT"); |
| 35 #endif |
| 30 #elif defined(OS_WIN) | 36 #elif defined(OS_WIN) |
| 37 #if defined(ARCH_CPU_X86) |
| 31 FILE_PATH_LITERAL("components\\flapper\\windows"); | 38 FILE_PATH_LITERAL("components\\flapper\\windows"); |
| 39 #elif defined(ARCH_CPU_X86_64) |
| 40 FILE_PATH_LITERAL("components\\flapper\\windows_x64"); |
| 41 #else |
| 42 FILE_PATH_LITERAL("components\\flapper\\NONEXISTENT"); |
| 43 #endif |
| 32 #else // OS_LINUX, etc. | 44 #else // OS_LINUX, etc. |
| 33 #if defined(ARCH_CPU_X86) | 45 #if defined(ARCH_CPU_X86) |
| 34 FILE_PATH_LITERAL("components/flapper/linux"); | 46 FILE_PATH_LITERAL("components/flapper/linux"); |
| 35 #elif defined(ARCH_CPU_X86_64) | 47 #elif defined(ARCH_CPU_X86_64) |
| 36 FILE_PATH_LITERAL("components/flapper/linux_x64"); | 48 FILE_PATH_LITERAL("components/flapper/linux_x64"); |
| 37 #else | 49 #else |
| 38 FILE_PATH_LITERAL("components/flapper/NONEXISTENT"); | 50 FILE_PATH_LITERAL("components/flapper/NONEXISTENT"); |
| 39 #endif | 51 #endif |
| 40 #endif | 52 #endif |
| 41 } // namespace | 53 } // namespace |
| 42 | 54 |
| 43 // TODO(jschuh): Get Pepper Flash supported on Win64 build. | |
| 44 // http://crbug.com/179716 | |
| 45 #if defined(OS_WIN) && defined(ARCH_CPU_X86_64) | |
| 46 #define MAYBE_PepperFlashCheck DISABLED_PepperFlashCheck | |
| 47 // TODO(avi): Get Pepper Flash supported on the Mac 64 bit build. | |
| 48 // http://crbug.com/225777 | |
| 49 #elif defined(OS_MACOSX) && defined(ARCH_CPU_X86_64) | |
| 50 #define MAYBE_PepperFlashCheck DISABLED_PepperFlashCheck | |
| 51 #else | |
| 52 #define MAYBE_PepperFlashCheck PepperFlashCheck | |
| 53 #endif | |
| 54 | |
| 55 // TODO(viettrungluu): Separate out into two separate tests; use a test fixture. | 55 // TODO(viettrungluu): Separate out into two separate tests; use a test fixture. |
| 56 TEST(ComponentInstallerTest, MAYBE_PepperFlashCheck) { | 56 TEST(ComponentInstallerTest, PepperFlashCheck) { |
| 57 base::MessageLoop message_loop; | 57 base::MessageLoop message_loop; |
| 58 content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop); | 58 content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop); |
| 59 | 59 |
| 60 ppapi::PpapiGlobals::PerThreadForTest per_thread_for_test; | 60 ppapi::PpapiGlobals::PerThreadForTest per_thread_for_test; |
| 61 ppapi::TestGlobals test_globals(per_thread_for_test); | 61 ppapi::TestGlobals test_globals(per_thread_for_test); |
| 62 ppapi::PpapiGlobals::SetPpapiGlobalsOnThreadForTest(&test_globals); | 62 ppapi::PpapiGlobals::SetPpapiGlobalsOnThreadForTest(&test_globals); |
| 63 | 63 |
| 64 // The test directory is chrome/test/data/components/flapper. | 64 // The test directory is chrome/test/data/components/flapper. |
| 65 base::FilePath manifest; | 65 base::FilePath manifest; |
| 66 PathService::Get(chrome::DIR_TEST_DATA, &manifest); | 66 PathService::Get(chrome::DIR_TEST_DATA, &manifest); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 79 ASSERT_TRUE(root); | 79 ASSERT_TRUE(root); |
| 80 ASSERT_TRUE(root->IsType(base::Value::TYPE_DICTIONARY)); | 80 ASSERT_TRUE(root->IsType(base::Value::TYPE_DICTIONARY)); |
| 81 | 81 |
| 82 // This checks that the whole manifest is compatible. | 82 // This checks that the whole manifest is compatible. |
| 83 Version version; | 83 Version version; |
| 84 EXPECT_TRUE(CheckPepperFlashManifest(*root, &version)); | 84 EXPECT_TRUE(CheckPepperFlashManifest(*root, &version)); |
| 85 EXPECT_TRUE(version.IsValid()); | 85 EXPECT_TRUE(version.IsValid()); |
| 86 } | 86 } |
| 87 | 87 |
| 88 } // namespace component_updater | 88 } // namespace component_updater |
| OLD | NEW |