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

Side by Side Diff: content/browser/device_orientation/device_orientation_browsertest.cc

Issue 10823318: Moves device_orientation to content namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Attempts to fix trybots Created 8 years, 4 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
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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/file_path.h" 6 #include "base/file_path.h"
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "content/browser/device_orientation/device_data.h" 9 #include "content/browser/device_orientation/device_data.h"
10 #include "content/browser/device_orientation/orientation.h" 10 #include "content/browser/device_orientation/orientation.h"
11 #include "content/browser/device_orientation/provider.h" 11 #include "content/browser/device_orientation/provider.h"
12 #include "content/public/browser/web_contents.h" 12 #include "content/public/browser/web_contents.h"
13 #include "content/public/common/content_switches.h" 13 #include "content/public/common/content_switches.h"
14 #include "content/shell/shell.h" 14 #include "content/shell/shell.h"
15 #include "content/test/content_browser_test.h" 15 #include "content/test/content_browser_test.h"
16 #include "content/test/content_browser_test_utils.h" 16 #include "content/test/content_browser_test_utils.h"
17 17
18 namespace device_orientation { 18 namespace content {
19 19
20 class MockProvider : public Provider { 20 class MockProvider : public Provider {
21 public: 21 public:
22 MockProvider(const DeviceData* device_data, DeviceData::Type type) 22 MockProvider(const DeviceData* device_data, DeviceData::Type type)
23 : device_data_(device_data), 23 : device_data_(device_data),
24 device_data_type_(type), 24 device_data_type_(type),
25 added_observer_(false), 25 added_observer_(false),
26 removed_observer_(false) { 26 removed_observer_(false) {
27 } 27 }
28 28
29 virtual void AddObserver(Observer* observer) { 29 virtual void AddObserver(Observer* observer) {
30 added_observer_ = true; 30 added_observer_ = true;
31 observer->OnDeviceDataUpdate(device_data_.get(), device_data_type_); 31 observer->OnDeviceDataUpdate(device_data_.get(), device_data_type_);
32 } 32 }
33 virtual void RemoveObserver(Observer* observer) { 33 virtual void RemoveObserver(Observer* observer) {
34 removed_observer_ = true; 34 removed_observer_ = true;
35 } 35 }
36 36
37 scoped_refptr<const DeviceData> device_data_; 37 scoped_refptr<const DeviceData> device_data_;
38 DeviceData::Type device_data_type_; 38 DeviceData::Type device_data_type_;
39 bool added_observer_; 39 bool added_observer_;
40 bool removed_observer_; 40 bool removed_observer_;
41 41
42 private: 42 private:
43 virtual ~MockProvider() {} 43 virtual ~MockProvider() {}
44 }; 44 };
45 45
46 class DeviceOrientationBrowserTest : public content::ContentBrowserTest { 46 class DeviceOrientationBrowserTest : public content::ContentBrowserTest {
jam 2012/08/15 19:12:46 nit: get rid of content:: in this file
47 public: 47 public:
48 // From ContentBrowserTest. 48 // From ContentBrowserTest.
49 virtual void SetUpCommandLine(CommandLine* command_line) { 49 virtual void SetUpCommandLine(CommandLine* command_line) {
50 EXPECT_TRUE(!command_line->HasSwitch(switches::kDisableDeviceOrientation)); 50 EXPECT_TRUE(!command_line->HasSwitch(switches::kDisableDeviceOrientation));
51 } 51 }
52 }; 52 };
53 53
54 // crbug.com/113952 54 // crbug.com/113952
55 IN_PROC_BROWSER_TEST_F(DeviceOrientationBrowserTest, BasicTest) { 55 IN_PROC_BROWSER_TEST_F(DeviceOrientationBrowserTest, BasicTest) {
56 scoped_refptr<Orientation> test_orientation(new Orientation()); 56 scoped_refptr<Orientation> test_orientation(new Orientation());
(...skipping 12 matching lines...) Expand all
69 "device_orientation", "device_orientation_test.html"); 69 "device_orientation", "device_orientation_test.html");
70 content::NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); 70 content::NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2);
71 71
72 // Check that the page got the event it expected and that the provider 72 // Check that the page got the event it expected and that the provider
73 // saw requests for adding and removing an observer. 73 // saw requests for adding and removing an observer.
74 EXPECT_EQ("pass", shell()->web_contents()->GetURL().ref()); 74 EXPECT_EQ("pass", shell()->web_contents()->GetURL().ref());
75 EXPECT_TRUE(provider->added_observer_); 75 EXPECT_TRUE(provider->added_observer_);
76 EXPECT_TRUE(provider->removed_observer_); 76 EXPECT_TRUE(provider->removed_observer_);
77 } 77 }
78 78
79 } // namespace device_orientation 79 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698