OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/strings/stringprintf.h" | 5 #include "base/strings/stringprintf.h" |
6 #include "chrome/browser/apps/app_browsertest_util.h" | 6 #include "chrome/browser/apps/app_browsertest_util.h" |
7 #include "chrome/test/base/ui_test_utils.h" | 7 #include "chrome/test/base/ui_test_utils.h" |
8 #include "content/public/browser/notification_service.h" | 8 #include "content/public/browser/notification_service.h" |
9 #include "content/public/browser/render_process_host.h" | 9 #include "content/public/browser/render_process_host.h" |
10 #include "content/public/test/browser_test_utils.h" | 10 #include "content/public/test/browser_test_utils.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 return web_contents_; | 30 return web_contents_; |
31 | 31 |
32 message_loop_runner_ = new content::MessageLoopRunner; | 32 message_loop_runner_ = new content::MessageLoopRunner; |
33 message_loop_runner_->Run(); | 33 message_loop_runner_->Run(); |
34 return web_contents_; | 34 return web_contents_; |
35 } | 35 } |
36 | 36 |
37 private: | 37 private: |
38 // GuestViewManager override: | 38 // GuestViewManager override: |
39 virtual void AddGuest(int guest_instance_id, | 39 virtual void AddGuest(int guest_instance_id, |
40 content::WebContents* guest_web_contents) OVERRIDE{ | 40 content::WebContents* guest_web_contents) override{ |
41 extensions::GuestViewManager::AddGuest( | 41 extensions::GuestViewManager::AddGuest( |
42 guest_instance_id, guest_web_contents); | 42 guest_instance_id, guest_web_contents); |
43 web_contents_ = guest_web_contents; | 43 web_contents_ = guest_web_contents; |
44 | 44 |
45 if (message_loop_runner_.get()) | 45 if (message_loop_runner_.get()) |
46 message_loop_runner_->Quit(); | 46 message_loop_runner_->Quit(); |
47 } | 47 } |
48 | 48 |
49 content::WebContents* web_contents_; | 49 content::WebContents* web_contents_; |
50 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; | 50 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; |
51 }; | 51 }; |
52 | 52 |
53 // Test factory for creating test instances of GuestViewManager. | 53 // Test factory for creating test instances of GuestViewManager. |
54 class TestGuestViewManagerFactory : public extensions::GuestViewManagerFactory { | 54 class TestGuestViewManagerFactory : public extensions::GuestViewManagerFactory { |
55 public: | 55 public: |
56 TestGuestViewManagerFactory() : | 56 TestGuestViewManagerFactory() : |
57 test_guest_view_manager_(NULL) {} | 57 test_guest_view_manager_(NULL) {} |
58 | 58 |
59 virtual ~TestGuestViewManagerFactory() {} | 59 virtual ~TestGuestViewManagerFactory() {} |
60 | 60 |
61 virtual extensions::GuestViewManager* CreateGuestViewManager( | 61 virtual extensions::GuestViewManager* CreateGuestViewManager( |
62 content::BrowserContext* context) OVERRIDE { | 62 content::BrowserContext* context) override { |
63 return GetManager(context); | 63 return GetManager(context); |
64 } | 64 } |
65 | 65 |
66 TestGuestViewManager* GetManager(content::BrowserContext* context) { | 66 TestGuestViewManager* GetManager(content::BrowserContext* context) { |
67 if (!test_guest_view_manager_) { | 67 if (!test_guest_view_manager_) { |
68 test_guest_view_manager_ = new TestGuestViewManager(context); | 68 test_guest_view_manager_ = new TestGuestViewManager(context); |
69 } | 69 } |
70 return test_guest_view_manager_; | 70 return test_guest_view_manager_; |
71 } | 71 } |
72 | 72 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 base::StringPrintf("runTest('%s', '%s')", | 124 base::StringPrintf("runTest('%s', '%s')", |
125 test_name.c_str(), | 125 test_name.c_str(), |
126 app_to_embed.c_str()))) { | 126 app_to_embed.c_str()))) { |
127 LOG(ERROR) << "UNABLE TO START TEST."; | 127 LOG(ERROR) << "UNABLE TO START TEST."; |
128 return; | 128 return; |
129 } | 129 } |
130 ASSERT_TRUE(done_listener.WaitUntilSatisfied()); | 130 ASSERT_TRUE(done_listener.WaitUntilSatisfied()); |
131 } | 131 } |
132 | 132 |
133 private: | 133 private: |
134 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 134 virtual void SetUpCommandLine(CommandLine* command_line) override { |
135 extensions::PlatformAppBrowserTest::SetUpCommandLine(command_line); | 135 extensions::PlatformAppBrowserTest::SetUpCommandLine(command_line); |
136 } | 136 } |
137 | 137 |
138 TestGuestViewManagerFactory factory_; | 138 TestGuestViewManagerFactory factory_; |
139 }; | 139 }; |
140 | 140 |
141 // Tests that <appview> is able to navigate to another installed app. | 141 // Tests that <appview> is able to navigate to another installed app. |
142 IN_PROC_BROWSER_TEST_F(AppViewTest, TestAppViewWithUndefinedDataShouldSucceed) { | 142 IN_PROC_BROWSER_TEST_F(AppViewTest, TestAppViewWithUndefinedDataShouldSucceed) { |
143 const extensions::Extension* skeleton_app = | 143 const extensions::Extension* skeleton_app = |
144 InstallPlatformApp("app_view/shim/skeleton"); | 144 InstallPlatformApp("app_view/shim/skeleton"); |
(...skipping 15 matching lines...) Expand all Loading... |
160 | 160 |
161 // Tests that <appview> correctly processes parameters passed on connect. | 161 // Tests that <appview> correctly processes parameters passed on connect. |
162 IN_PROC_BROWSER_TEST_F(AppViewTest, TestAppViewGoodDataShouldSucceed) { | 162 IN_PROC_BROWSER_TEST_F(AppViewTest, TestAppViewGoodDataShouldSucceed) { |
163 const extensions::Extension* skeleton_app = | 163 const extensions::Extension* skeleton_app = |
164 InstallPlatformApp("app_view/shim/skeleton"); | 164 InstallPlatformApp("app_view/shim/skeleton"); |
165 TestHelper("testAppViewGoodDataShouldSucceed", | 165 TestHelper("testAppViewGoodDataShouldSucceed", |
166 "app_view/shim", | 166 "app_view/shim", |
167 skeleton_app->id(), | 167 skeleton_app->id(), |
168 NO_TEST_SERVER); | 168 NO_TEST_SERVER); |
169 } | 169 } |
OLD | NEW |