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

Unified Diff: remoting/client/plugin/chromoting_plugin_unittest.cc

Issue 2690003: Copy the (early prototype of) remoting in Chrome into the public tree.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/client/plugin/chromoting_plugin_test.html ('k') | remoting/client/plugin/chromotocol.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/plugin/chromoting_plugin_unittest.cc
===================================================================
--- remoting/client/plugin/chromoting_plugin_unittest.cc (revision 0)
+++ remoting/client/plugin/chromoting_plugin_unittest.cc (revision 0)
@@ -0,0 +1,93 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/logging.h"
+#include "base/scoped_ptr.h"
+#include "remoting/client/plugin/chromoting_plugin.h"
+#include "remoting/client/pepper/fake_browser.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+// Routine to create the PepperPlugin subclass that implements all of the
+// plugin-specific functionality.
+pepper::PepperPlugin* CreatePlugin(NPNetscapeFuncs* browser_funcs,
+ NPP instance);
+
+
+class ChromotingPluginTest : public testing::Test {
+ protected:
+
+ virtual void SetUp() {
+ // Set up the fake browser callback routines.
+ fake_browser_ = Singleton<FakeBrowser>::get();
+ NPNetscapeFuncs* browser_funcs_ = fake_browser_->GetBrowserFuncs();
+ instance_.reset(new NPP_t());
+
+ // Create the ChromotingPlugin for testing.
+ pepper::PepperPlugin* pepper_plugin;
+ pepper_plugin = CreatePlugin(browser_funcs_, instance_.get());
+ plugin_.reset(
+ reinterpret_cast<remoting::ChromotingPlugin*>(pepper_plugin));
+ }
+
+ virtual void TearDown() {
+ }
+
+ FakeBrowser* fake_browser_;
+ scoped_ptr<NPP_t> instance_;
+ scoped_ptr<remoting::ChromotingPlugin> plugin_;
+};
+
+TEST_F(ChromotingPluginTest, TestSetup) {
+ ASSERT_TRUE(plugin_->browser() != NULL);
+ ASSERT_TRUE(plugin_->extensions() != NULL);
+ ASSERT_TRUE(plugin_->instance() != NULL);
+
+ ASSERT_TRUE(plugin_->device() != NULL);
+}
+
+TEST_F(ChromotingPluginTest, TestNew) {
+ NPMIMEType mimetype =
+ const_cast<NPMIMEType>("pepper-application/x-chromoting-plugin");
+ int16 argc;
+ char* argn[4];
+ char* argv[4];
+ NPError result;
+
+ // Test 0 arguments (NULL arrays).
+ argc = 0;
+ result = plugin_->New(mimetype, argc, NULL, NULL);
+ ASSERT_EQ(NPERR_GENERIC_ERROR, result);
+
+ // Test 0 arguments.
+ argc = 0;
+ result = plugin_->New(mimetype, argc, argn, argv);
+ ASSERT_EQ(NPERR_GENERIC_ERROR, result);
+
+ // Test 1 argument (missing "src").
+ argc = 1;
+ argn[0] = const_cast<char*>("noturl");
+ argv[0] = const_cast<char*>("random.value");
+ result = plugin_->New(mimetype, argc, argn, argv);
+ ASSERT_EQ(NPERR_GENERIC_ERROR, result);
+
+ // Test "src" argument.
+ argc = 1;
+ argn[0] = const_cast<char*>("src");
+ argv[0] = const_cast<char*>("chromotocol:name@chromoting.org");
+ result = plugin_->New(mimetype, argc, argn, argv);
+ ASSERT_EQ(NPERR_NO_ERROR, result);
+}
+
+
+static uint32 get_pixel(uint32* pixels, int stride, int x, int y) {
+ return pixels[((x) + ((y) * (stride >> 2)))];
+}
+
+TEST_F(ChromotingPluginTest, TestSetWindow) {
+ NPWindow* window = fake_browser_->GetWindow();
+ NPError result;
+
+ result = plugin_->SetWindow(window);
+ ASSERT_EQ(NPERR_NO_ERROR, result);
+}
Property changes on: remoting/client/plugin/chromoting_plugin_unittest.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « remoting/client/plugin/chromoting_plugin_test.html ('k') | remoting/client/plugin/chromotocol.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698