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

Unified Diff: chrome/browser/device_orientation/device_orientation_browsertest.cc

Issue 6586001: Move appcache/file_sytem/device_orientation subdirectories of chrome\browser ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 9 years, 10 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
Index: chrome/browser/device_orientation/device_orientation_browsertest.cc
===================================================================
--- chrome/browser/device_orientation/device_orientation_browsertest.cc (revision 75978)
+++ chrome/browser/device_orientation/device_orientation_browsertest.cc (working copy)
@@ -1,70 +0,0 @@
-// 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/command_line.h"
-#include "base/file_path.h"
-#include "base/ref_counted.h"
-#include "chrome/browser/device_orientation/orientation.h"
-#include "chrome/browser/device_orientation/provider.h"
-#include "chrome/browser/tab_contents/tab_contents.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/common/chrome_switches.h"
-#include "chrome/test/in_process_browser_test.h"
-#include "chrome/test/ui_test_utils.h"
-
-namespace device_orientation {
-
-class MockProvider : public Provider {
- public:
- explicit MockProvider(const Orientation& orientation)
- : orientation_(orientation),
- added_observer_(false),
- removed_observer_(false) {}
-
- virtual void AddObserver(Observer* observer) {
- added_observer_ = true;
- observer->OnOrientationUpdate(orientation_);
- }
- virtual void RemoveObserver(Observer* observer) {
- removed_observer_ = true;
- }
- Orientation orientation_;
- bool added_observer_;
- bool removed_observer_;
-};
-
-class DeviceOrientationBrowserTest : public InProcessBrowserTest {
- public:
- // From InProcessBrowserTest.
- virtual void SetUpCommandLine(CommandLine* command_line) {
- EXPECT_TRUE(!command_line->HasSwitch(switches::kDisableDeviceOrientation));
- }
-
- GURL testUrl(const FilePath::CharType* filename) {
- const FilePath kTestDir(FILE_PATH_LITERAL("device_orientation"));
- return ui_test_utils::GetTestUrl(kTestDir, FilePath(filename));
- }
-};
-
-IN_PROC_BROWSER_TEST_F(DeviceOrientationBrowserTest, BasicTest) {
- const Orientation kTestOrientation(true, 1, true, 2, true, 3);
- scoped_refptr<MockProvider> provider(new MockProvider(kTestOrientation));
- Provider::SetInstanceForTests(provider.get());
-
- // The test page will register an event handler for orientation events,
- // expects to get an event with kTestOrientation orientation,
- // then removes the event handler and navigates to #pass.
- GURL test_url = testUrl(FILE_PATH_LITERAL("device_orientation_test.html"));
- ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(),
- test_url,
- 2);
-
- // Check that the page got the event it expected and that the provider
- // saw requests for adding and removing an observer.
- EXPECT_EQ("pass", browser()->GetSelectedTabContents()->GetURL().ref());
- EXPECT_TRUE(provider->added_observer_);
- EXPECT_TRUE(provider->removed_observer_);
-}
-
-} // namespace device_orientation
« no previous file with comments | « chrome/browser/device_orientation/data_fetcher.h ('k') | chrome/browser/device_orientation/message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698