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

Side by Side Diff: components/web_view/web_view_apptest.cc

Issue 1340983002: Mandoline UI Process: Update namespaces and file names (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 3 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/web_view/public/cpp/web_view.h" 5 #include "components/web_view/public/cpp/web_view.h"
6 6
7 #include "base/base_paths.h" 7 #include "base/base_paths.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 10 matching lines...) Expand all
21 21
22 namespace { 22 namespace {
23 const char kTestOneFile[] = "test_one.html"; 23 const char kTestOneFile[] = "test_one.html";
24 const char kTestOneTitle[] = "Test Title One"; 24 const char kTestOneTitle[] = "Test Title One";
25 const char kTestTwoFile[] = "test_two.html"; 25 const char kTestTwoFile[] = "test_two.html";
26 const char kTestTwoTitle[] = "Test Title Two"; 26 const char kTestTwoTitle[] = "Test Title Two";
27 const char kTestThreeFile[] = "test_three.html"; 27 const char kTestThreeFile[] = "test_three.html";
28 const char kTestThreeTitle[] = "Test Title Three"; 28 const char kTestThreeTitle[] = "Test Title Three";
29 } 29 }
30 30
31 class WebViewTest : public mojo::ViewManagerTestBase, 31 class WebViewTest : public mus::ViewManagerTestBase,
32 public mojom::WebViewClient { 32 public mojom::WebViewClient {
33 public: 33 public:
34 WebViewTest() : web_view_(this) {} 34 WebViewTest() : web_view_(this) {}
35 ~WebViewTest() override {} 35 ~WebViewTest() override {}
36 36
37 mojom::WebView* web_view() { return web_view_.web_view(); } 37 mojom::WebView* web_view() { return web_view_.web_view(); }
38 38
39 const std::string& last_title() { return last_title_; } 39 const std::string& last_title() { return last_title_; }
40 mojom::ButtonState last_back_button_state() { 40 mojom::ButtonState last_back_button_state() {
41 return last_back_button_state_; 41 return last_back_button_state_;
(...skipping 26 matching lines...) Expand all
68 } 68 }
69 } 69 }
70 70
71 // Overridden from ApplicationDelegate: 71 // Overridden from ApplicationDelegate:
72 void Initialize(mojo::ApplicationImpl* app) override { 72 void Initialize(mojo::ApplicationImpl* app) override {
73 ViewManagerTestBase::Initialize(app); 73 ViewManagerTestBase::Initialize(app);
74 app_ = app; 74 app_ = app;
75 } 75 }
76 76
77 // Overridden from ViewTreeDelegate: 77 // Overridden from ViewTreeDelegate:
78 void OnEmbed(mojo::View* root) override { 78 void OnEmbed(mus::View* root) override {
79 content_ = root->connection()->CreateView(); 79 content_ = root->connection()->CreateView();
80 root->AddChild(content_); 80 root->AddChild(content_);
81 content_->SetVisible(true); 81 content_->SetVisible(true);
82 82
83 web_view_.Init(app_, content_); 83 web_view_.Init(app_, content_);
84 84
85 ViewManagerTestBase::OnEmbed(root); 85 ViewManagerTestBase::OnEmbed(root);
86 } 86 }
87 87
88 void TearDown() override { 88 void TearDown() override {
89 mojo::ScopedViewPtr::DeleteViewOrViewManager(window_manager()->GetRoot()); 89 mus::ScopedViewPtr::DeleteViewOrViewManager(window_manager()->GetRoot());
90 ViewManagerTestBase::TearDown(); 90 ViewManagerTestBase::TearDown();
91 } 91 }
92 92
93 // Overridden from web_view::mojom::WebViewClient: 93 // Overridden from web_view::mojom::WebViewClient:
94 void TopLevelNavigate(mojo::URLRequestPtr request) override {} 94 void TopLevelNavigate(mojo::URLRequestPtr request) override {}
95 void LoadingStateChanged(bool is_loading, double progress) override { 95 void LoadingStateChanged(bool is_loading, double progress) override {
96 if (is_loading == false) 96 if (is_loading == false)
97 QuitNestedRunLoop(); 97 QuitNestedRunLoop();
98 } 98 }
99 void BackForwardChanged(mojom::ButtonState back_button, 99 void BackForwardChanged(mojom::ButtonState back_button,
100 mojom::ButtonState forward_button) override { 100 mojom::ButtonState forward_button) override {
101 last_back_button_state_ = back_button; 101 last_back_button_state_ = back_button;
102 last_forward_button_state_ = forward_button; 102 last_forward_button_state_ = forward_button;
103 } 103 }
104 void TitleChanged(const mojo::String& title) override { 104 void TitleChanged(const mojo::String& title) override {
105 last_title_ = title.get(); 105 last_title_ = title.get();
106 } 106 }
107 107
108 mojo::ApplicationImpl* app_; 108 mojo::ApplicationImpl* app_;
109 109
110 mojo::View* content_; 110 mus::View* content_;
111 111
112 web_view::WebView web_view_; 112 web_view::WebView web_view_;
113 113
114 scoped_ptr<base::RunLoop> run_loop_; 114 scoped_ptr<base::RunLoop> run_loop_;
115 115
116 std::string last_title_; 116 std::string last_title_;
117 mojom::ButtonState last_back_button_state_; 117 mojom::ButtonState last_back_button_state_;
118 mojom::ButtonState last_forward_button_state_; 118 mojom::ButtonState last_forward_button_state_;
119 119
120 DISALLOW_COPY_AND_ASSIGN(WebViewTest); 120 DISALLOW_COPY_AND_ASSIGN(WebViewTest);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // Now navigate to a third file. This should clear the forward stack. 180 // Now navigate to a third file. This should clear the forward stack.
181 ASSERT_NO_FATAL_FAILURE(NavigateTo(kTestThreeFile)); 181 ASSERT_NO_FATAL_FAILURE(NavigateTo(kTestThreeFile));
182 182
183 EXPECT_EQ(kTestThreeTitle, last_title()); 183 EXPECT_EQ(kTestThreeTitle, last_title());
184 EXPECT_EQ(mojom::ButtonState::BUTTON_STATE_ENABLED, last_back_button_state()); 184 EXPECT_EQ(mojom::ButtonState::BUTTON_STATE_ENABLED, last_back_button_state());
185 EXPECT_EQ(mojom::ButtonState::BUTTON_STATE_DISABLED, 185 EXPECT_EQ(mojom::ButtonState::BUTTON_STATE_DISABLED,
186 last_forward_button_state()); 186 last_forward_button_state());
187 } 187 }
188 188
189 } // namespace web_view 189 } // namespace web_view
OLDNEW
« no previous file with comments | « components/web_view/test_runner/test_runner_application_delegate.cc ('k') | components/web_view/web_view_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698