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" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 // TODO(avi): Get Pepper Flash supported on the Mac 64 bit build. | 45 // TODO(avi): Get Pepper Flash supported on the Mac 64 bit build. |
46 // http://crbug.com/225777 | 46 // http://crbug.com/225777 |
47 #elif defined(OS_MACOSX) && defined(ARCH_CPU_X86_64) | 47 #elif defined(OS_MACOSX) && defined(ARCH_CPU_X86_64) |
48 #define MAYBE_PepperFlashCheck DISABLED_PepperFlashCheck | 48 #define MAYBE_PepperFlashCheck DISABLED_PepperFlashCheck |
49 #else | 49 #else |
50 #define MAYBE_PepperFlashCheck PepperFlashCheck | 50 #define MAYBE_PepperFlashCheck PepperFlashCheck |
51 #endif | 51 #endif |
52 | 52 |
53 // TODO(viettrungluu): Separate out into two separate tests; use a test fixture. | 53 // TODO(viettrungluu): Separate out into two separate tests; use a test fixture. |
54 TEST(ComponentInstallerTest, MAYBE_PepperFlashCheck) { | 54 TEST(ComponentInstallerTest, MAYBE_PepperFlashCheck) { |
55 MessageLoop message_loop; | 55 base::MessageLoop message_loop; |
56 content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop); | 56 content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop); |
57 | 57 |
58 ppapi::PpapiGlobals::PerThreadForTest per_thread_for_test; | 58 ppapi::PpapiGlobals::PerThreadForTest per_thread_for_test; |
59 ppapi::TestGlobals test_globals(per_thread_for_test); | 59 ppapi::TestGlobals test_globals(per_thread_for_test); |
60 ppapi::PpapiGlobals::SetPpapiGlobalsOnThreadForTest(&test_globals); | 60 ppapi::PpapiGlobals::SetPpapiGlobalsOnThreadForTest(&test_globals); |
61 | 61 |
62 // The test directory is chrome/test/data/components/flapper. | 62 // The test directory is chrome/test/data/components/flapper. |
63 base::FilePath manifest; | 63 base::FilePath manifest; |
64 PathService::Get(chrome::DIR_TEST_DATA, &manifest); | 64 PathService::Get(chrome::DIR_TEST_DATA, &manifest); |
65 manifest = manifest.Append(kDataPath); | 65 manifest = manifest.Append(kDataPath); |
66 manifest = manifest.AppendASCII("manifest.json"); | 66 manifest = manifest.AppendASCII("manifest.json"); |
67 | 67 |
68 if (!file_util::PathExists(manifest)) { | 68 if (!file_util::PathExists(manifest)) { |
69 LOG(WARNING) << "No test manifest available. Skipping."; | 69 LOG(WARNING) << "No test manifest available. Skipping."; |
70 return; | 70 return; |
71 } | 71 } |
72 | 72 |
73 JSONFileValueSerializer serializer(manifest); | 73 JSONFileValueSerializer serializer(manifest); |
74 std::string error; | 74 std::string error; |
75 scoped_ptr<base::DictionaryValue> root(static_cast<base::DictionaryValue*>( | 75 scoped_ptr<base::DictionaryValue> root(static_cast<base::DictionaryValue*>( |
76 serializer.Deserialize(NULL, &error))); | 76 serializer.Deserialize(NULL, &error))); |
77 ASSERT_TRUE(root); | 77 ASSERT_TRUE(root); |
78 ASSERT_TRUE(root->IsType(base::Value::TYPE_DICTIONARY)); | 78 ASSERT_TRUE(root->IsType(base::Value::TYPE_DICTIONARY)); |
79 | 79 |
80 // This checks that the whole manifest is compatible. | 80 // This checks that the whole manifest is compatible. |
81 Version version; | 81 Version version; |
82 EXPECT_TRUE(CheckPepperFlashManifest(*root, &version)); | 82 EXPECT_TRUE(CheckPepperFlashManifest(*root, &version)); |
83 EXPECT_TRUE(version.IsValid()); | 83 EXPECT_TRUE(version.IsValid()); |
84 } | 84 } |
OLD | NEW |