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

Side by Side Diff: chrome/renderer/extensions/greasemonkey_api_unittest.cc

Issue 149619: Various minor extension fixes (Closed)
Patch Set: One more test Created 11 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
OLDNEW
(Empty)
1 // Copyright (c) 2009 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 "app/resource_bundle.h"
6 #include "base/file_util.h"
7 #include "base/path_service.h"
8 #include "base/string_util.h"
9 #include "chrome/common/chrome_paths.h"
10 #include "chrome/test/v8_unit_test.h"
11 #include "testing/gtest/include/gtest/gtest.h"
12
13 #include "grit/renderer_resources.h"
14
15 // TODO(port)
16 #if defined(OS_WIN)
17
18 static const char kGreasemonkeyApi[] = "greasemonkey_api.js";
19 static const char kGreasemonkeyApiTest[] = "greasemonkey_api_test.js";
20
21 class GreasemonkeyApiTest : public V8UnitTest {
22 public:
23 GreasemonkeyApiTest() {}
24
25 virtual void SetUp() {
26 V8UnitTest::SetUp();
27
28 // Add the greasemonkey api to the context.
29 StringPiece api_js =
30 ResourceBundle::GetSharedInstance().GetRawDataResource(
31 IDR_GREASEMONKEY_API_JS);
32 ExecuteScriptInContext(api_js, kGreasemonkeyApi);
33
34 // Add the test functions to the context.
35 std::wstring test_js_file_path;
36 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_js_file_path));
37 file_util::AppendToPath(&test_js_file_path, L"extensions");
38 file_util::AppendToPath(&test_js_file_path,
39 UTF8ToWide(kGreasemonkeyApiTest));
40 std::string test_js;
41 ASSERT_TRUE(file_util::ReadFileToString(test_js_file_path, &test_js));
42 ExecuteScriptInContext(test_js, kGreasemonkeyApiTest);
43 }
44 };
45
46 TEST_F(GreasemonkeyApiTest, GetSetValue) {
47 TestFunction("testGetSetValue");
48 }
49
50 TEST_F(GreasemonkeyApiTest, DeleteValue) {
51 TestFunction("testDeleteValue");
52 }
53
54 TEST_F(GreasemonkeyApiTest, ListValues) {
55 TestFunction("testListValues");
56 }
57
58 TEST_F(GreasemonkeyApiTest, GetResourceURL) {
59 TestFunction("testGetResourceURL");
60 }
61
62 TEST_F(GreasemonkeyApiTest, GetResourceText) {
63 TestFunction("testGetResourceText");
64 }
65
66 TEST_F(GreasemonkeyApiTest, AddStyle) {
67 TestFunction("testAddStyle");
68 }
69
70 TEST_F(GreasemonkeyApiTest, XmlhttpRequest) {
71 TestFunction("testXmlhttpRequest");
72 }
73
74 TEST_F(GreasemonkeyApiTest, RegisterMenuCommand) {
75 TestFunction("testRegisterMenuCommand");
76 }
77
78 TEST_F(GreasemonkeyApiTest, OpenInTab) {
79 TestFunction("testOpenInTab");
80 }
81
82 TEST_F(GreasemonkeyApiTest, Log) {
83 TestFunction("testLog");
84 }
85
86 #endif // #if defined(OSWIN)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698