Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: chrome/browser/component_updater/component_installers_unittest.cc

Issue 10702188: Fix unit test to allow repeated successful runs by avoiding a function static variable in tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add DEPS file Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/component_updater/component_updater_service_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/component_updater/flash_component_installer.h"
6
7 #include "base/file_path.h"
8 #include "base/file_util.h"
9 #include "base/json/json_file_value_serializer.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/message_loop.h"
12 #include "base/path_service.h"
13 #include "base/version.h"
14 #include "build/build_config.h"
15 #include "chrome/common/chrome_paths.h"
16 #include "content/public/test/test_browser_thread.h"
17
18 #include "testing/gtest/include/gtest/gtest.h"
19
20 using content::BrowserThread;
21
22 namespace {
23 // File name of the Pepper Flash plugin on different platforms.
24 const FilePath::CharType kDataPath[] =
25 #if defined(OS_MACOSX)
26 FILE_PATH_LITERAL("components/flapper/mac");
27 #elif defined(OS_WIN)
28 FILE_PATH_LITERAL("components\\flapper\\windows");
29 #else // OS_LINUX, etc.
30 #if defined(ARCH_CPU_X86)
31 FILE_PATH_LITERAL("components/flapper/linux");
32 #elif defined(ARCH_CPU_X86_64)
33 FILE_PATH_LITERAL("components/flapper/linux_x64");
34 #else
35 FILE_PATH_LITERAL("components/flapper/NONEXISTENT");
36 #endif
37 #endif
38 }
39
40 // TODO(viettrungluu): Separate out into two separate tests; use a test fixture.
41 TEST(ComponentInstallerTest, PepperFlashCheck) {
42 MessageLoop message_loop;
43 content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop);
44
45 // The test directory is chrome/test/data/components/flapper.
46 FilePath manifest;
47 PathService::Get(chrome::DIR_TEST_DATA, &manifest);
48 manifest = manifest.Append(kDataPath);
49 manifest = manifest.AppendASCII("manifest.json");
50
51 if (!file_util::PathExists(manifest)) {
52 LOG(WARNING) << "No test manifest available. Skipping.";
53 return;
54 }
55
56 JSONFileValueSerializer serializer(manifest);
57 std::string error;
58 scoped_ptr<base::Value> root(serializer.Deserialize(NULL, &error));
59 ASSERT_TRUE(root.get() != NULL);
60 ASSERT_TRUE(root->IsType(base::Value::TYPE_DICTIONARY));
61
62 // This checks that the whole manifest is compatible.
63 Version version;
64 EXPECT_TRUE(CheckPepperFlashManifest(
65 static_cast<base::DictionaryValue*>(root.get()), &version));
66 EXPECT_TRUE(version.IsValid());
67 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/component_updater/component_updater_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698